@Override protected ReusableByteArrayInputStream initialValue() { return new ReusableByteArrayInputStream(); } };
/** Set to the contents of a String. */ public Utf8 set(String string) { this.bytes = getBytesFor(string); this.length = bytes.length; this.string = string; return this; }
/** Set length in bytes. Should called whenever byte content changes, even * if the length does not change, as this also clears the cached String. * @deprecated call {@link #setByteLength(int)} instead. */ public Utf8 setLength(int newLength) { return setByteLength(newLength); }
@Override public Utf8 readString(Utf8 old) throws IOException { int length = readInt(); Utf8 result = (old != null ? old : new Utf8()); result.setByteLength(length); if (length > 0) { in.readFully(result.getBytes(), 0, length); } return result; }
@Override public String readString() throws IOException { return readString(stringDecoder).toString(); }
@Override public void writeString(Utf8 utf8) throws IOException { writeBytes(utf8.getBytes(), 0, utf8.getByteLength()); }
public V get(Object key) { reap(); return backingStore.get(new IdentityWeakReference(key)); } public V put(K key, V value) {
@Override protected Map<Schema,Map<Schema,ResolvingDecoder>> initialValue() { return new WeakIdentityHashMap<>(); } };
@Override protected ReusableByteBufferInputStream initialValue() { return new ReusableByteBufferInputStream(); } };
@Override public String toString() { if (this.length == 0) return ""; if (this.string == null) { this.string = UTF8_CONVERTER.fromUtf8(bytes, length); } return this.string; }
public Utf8(String string) { this.bytes = getBytesFor(string); this.length = bytes.length; this.string = string; }
/** Set length in bytes. Should called whenever byte content changes, even * if the length does not change, as this also clears the cached String. * @deprecated call {@link #setByteLength(int)} instead. */ public Utf8 setLength(int newLength) { return setByteLength(newLength); }
public V remove(Object key) { reap(); return backingStore.remove(new IdentityWeakReference(key)); } public int size() {
@Override protected ReusableByteArrayInputStream initialValue() { return new ReusableByteArrayInputStream(); } };
@Override protected ReusableByteBufferInputStream initialValue() { return new ReusableByteBufferInputStream(); } };
public Utf8(String string) { this.bytes = getBytesFor(string); this.length = bytes.length; this.string = string; }
public V remove(Object key) { reap(); return backingStore.remove(new IdentityWeakReference(key)); } public int size() {
/** Set to the contents of a String. */ public Utf8 set(String string) { this.bytes = getBytesFor(string); this.length = bytes.length; this.string = string; return this; }
public V get(Object key) { reap(); return backingStore.get(new IdentityWeakReference(key)); } public V put(K key, V value) {
@Override public void writeString(String str) throws IOException { byte[] bytes = Utf8.getBytesFor(str); writeBytes(bytes, 0, bytes.length); }