UTF8StringPointable extends AbstractPointable implements IHashable, IComparable { public void substrBefore(UTF8StringPointable match, UTF8StringBuilder builder, GrowableArray out) throws IOException { substrBefore(this, match, builder, out); }  static UTF8StringPointable generateUTF8Pointable(String string); char charAt(int offset); int charSize(int offset); int getStringLength(); int getUTF8Length(); int getMetaDataLength(); int getCharStartOffset(); @Override int compareTo(IPointable pointer); @Override int compareTo(byte[] bytes, int start, int length); @Override int hash(); void toString(StringBuilder buffer); @Override String toString(); int ignoreCaseCompareTo(UTF8StringPointable other); int find(UTF8StringPointable pattern, boolean ignoreCase); static int find(UTF8StringPointable src, UTF8StringPointable pattern, boolean ignoreCase); boolean contains(UTF8StringPointable pattern, boolean ignoreCase); static boolean contains(UTF8StringPointable src, UTF8StringPointable pattern, boolean ignoreCase); boolean startsWith(UTF8StringPointable pattern, boolean ignoreCase); static boolean startsWith(UTF8StringPointable src, UTF8StringPointable pattern, boolean ignoreCase); boolean endsWith(UTF8StringPointable pattern, boolean ignoreCase); static boolean endsWith(UTF8StringPointable src, UTF8StringPointable pattern, boolean ignoreCase); void concat(UTF8StringPointable next, UTF8StringBuilder builder, GrowableArray out); static void concat(UTF8StringPointable first, UTF8StringPointable next, UTF8StringBuilder builder,
            GrowableArray out); void substr(int charOffset, int charLength, UTF8StringBuilder builder, GrowableArray out); static void substr(UTF8StringPointable src, int charOffset, int charLength, UTF8StringBuilder builder,
            GrowableArray out); void substrBefore(UTF8StringPointable match, UTF8StringBuilder builder, GrowableArray out); static void substrBefore(UTF8StringPointable src, UTF8StringPointable match, UTF8StringBuilder builder,
            GrowableArray out); void substrAfter(UTF8StringPointable match, UTF8StringBuilder builder, GrowableArray out); static void substrAfter(UTF8StringPointable src, UTF8StringPointable match, UTF8StringBuilder builder,
            GrowableArray out); void lowercase(UTF8StringBuilder builder, GrowableArray out); static void lowercase(UTF8StringPointable src, UTF8StringBuilder builder, GrowableArray out); void uppercase(UTF8StringBuilder builder, GrowableArray out); static void uppercase(UTF8StringPointable src, UTF8StringBuilder builder, GrowableArray out); static final ITypeTraits TYPE_TRAITS; static final IPointableFactory FACTORY; }
@Test public void testSubstrBefore() throws Exception { UTF8StringBuilder builder = new UTF8StringBuilder(); GrowableArray storage = new GrowableArray(); STRING_LEN_128.substrBefore(STRING_LEN_127, builder, storage); UTF8StringPointable result = new UTF8StringPointable(); result.set(storage.getByteArray(), 0, storage.getLength()); assertEquals(0, STRING_EMPTY.compareTo(result)); storage.reset(); UTF8StringPointable testPtr = UTF8StringPointable.generateUTF8Pointable("Mix中文123"); UTF8StringPointable pattern = UTF8StringPointable.generateUTF8Pointable("文"); UTF8StringPointable expect = UTF8StringPointable.generateUTF8Pointable("Mix中"); testPtr.substrBefore(pattern, builder, storage); result.set(storage.getByteArray(), 0, storage.getLength()); assertEquals(0, expect.compareTo(result)); }