private void writeObject(java.io.ObjectOutputStream out) throws IOException { byte[] bytes = getBytesUnsafe(); out.writeInt(bytes.length); out.write(bytes); }
public static Binary fromReusedByteBuffer(final ByteBuffer value, int offset, int length) { return new ByteBufferBackedBinary(value, offset, length, true); }
public static Binary fromConstantByteBuffer(final ByteBuffer value) { return new ByteBufferBackedBinary(value, false); }
public static Binary fromConstantByteBuffer(final ByteBuffer value, int offset, int length) { return new ByteBufferBackedBinary(value, offset, length, false); }
public static Binary fromReusedByteBuffer(final ByteBuffer value, int offset, int length) { return new ByteBufferBackedBinary(value, offset, length, true); }
@Override public byte[] getBytesUnsafe() { return cachedBytes != null ? cachedBytes : getBytes(); }
public static Binary fromConstantByteBuffer(final ByteBuffer value) { return new ByteBufferBackedBinary(value, false); }
public static Binary fromReusedByteBuffer(final ByteBuffer value) { return new ByteBufferBackedBinary(value, true); }
public static Binary fromConstantByteBuffer(final ByteBuffer value, int offset, int length) { return new ByteBufferBackedBinary(value, offset, length, false); }
public static Binary fromReusedByteBuffer(final ByteBuffer value) { return new ByteBufferBackedBinary(value, true); }
@Override public byte[] getBytesUnsafe() { return cachedBytes != null ? cachedBytes : getBytes(); }
@Override public void writeTo(DataOutput out) throws IOException { // TODO: should not have to materialize those bytes out.write(getBytesUnsafe()); }
private void writeObject(java.io.ObjectOutputStream out) throws IOException { byte[] bytes = getBytesUnsafe(); out.writeInt(bytes.length); out.write(bytes); }
@Override public Binary slice(int start, int length) { return Binary.fromConstantByteArray(getBytesUnsafe(), start, length); } @Override
@Override public void writeTo(OutputStream out) throws IOException { if (value.hasArray()) { out.write(value.array(), value.arrayOffset() + offset, length); } else { out.write(getBytesUnsafe(), 0, length); } }
@Override public Binary slice(int start, int length) { return Binary.fromConstantByteArray(getBytesUnsafe(), start, length); } @Override
@Override public void writeTo(DataOutput out) throws IOException { // TODO: should not have to materialize those bytes out.write(getBytesUnsafe()); }
@Override public void writeTo(OutputStream out) throws IOException { if (value.hasArray()) { out.write(value.array(), value.arrayOffset() + offset, length); } else { out.write(getBytesUnsafe(), 0, length); } }