public void writeBinary(Binary binary) throws IOException { _writeArrayFieldNameIfNeeded(); _verifyValueWrite("write binary"); byte[] bytes = binary.getData(); _buffer.putByte(_typeMarker, BsonConstants.TYPE_BINARY); _buffer.putInt(bytes.length); _buffer.putByte(binary.getType()); _buffer.putBytes(binary.getData()); flushBuffer(); }
private Comparable<String> convertFrom(Binary binary) { return new String( binary .getData()); // + binary.getType(); // Adding getType() to respect contract of "equals"; }
public Builder initialTimestamp(Binary initialTimestamp) { this.initialTimestamp = new Timestamp.GTID(initialTimestamp.getData(), null); return this; }
protected void putBinary(String name, Binary val) { _put(BINARY, name); _buf.writeInt(val.length()); _buf.write(val.getType()); _buf.write(val.getData()); }