/** * Decompress and deserialize a {@link Value}. * * @param tmp * The serialized and compressed value. * * @return The {@link Value}. */ private Value getValue(final byte[] tmp) { // decompress final ByteBuffer b = compressor.decompress(tmp); final byte[] c = new byte[b.limit()]; b.get(c); // deserialize. return valSer.deserialize(c); }
/** * Return the <code>byte[]</code> value, which is the serialization of an * RDF {@link Value}. * * @param obj * An RDF {@link Value}. */ public byte[] serializeVal(final BigdataValue obj) { return valueSer.serialize(obj, buf.reset(), tbuf); }
protected void setUp() throws Exception { super.setUp(); fixture = new BigdataValueSerializer<Value>( ValueFactoryImpl.getInstance()); }
/** * Performs round trip (de-)serialization using * {@link BigdataValueSerializer#serialize()} and * {@link BigdataValueSerializer#deserialize(byte[])}. * * @param o * The {@link Value} * * @return The de-serialized {@link Value}. */ private Value roundTrip_tuned(final Value o) { return fixture.deserialize(fixture.serialize(o)); }
return deserializeVersion0(version, in); case VERSION1: return deserializeVersion1(version, in, tmp); default: throw new UnsupportedOperationException(ERR_VERSION + " : "
final short version = getVersion(val); serializeVersion0(val, version, out); break; case VERSION1: { serializeVersion1(val, version, out, tmp); break;
final BigdataValueSerializer<Value> fixture = new BigdataValueSerializer<Value>( ValueFactoryImpl.getInstance()); 97, 110, 32, 77, 99, 67, 97, 114, 116, 104, 121 }; final Value newValue = fixture.deserialize(newValBytes); final Value oldValue = fixture.deserialize(oldValBytes);
if (BigdataValueSerializer.getStringLength(val) < Short.MAX_VALUE) {
/** * Variant which permits reuse of the same buffer. This has the advantage * that the buffer is reused on each invocation and swiftly grows to its * maximum extent. * * @param val * The value. * @param out * The buffer - the caller is responsible for resetting the * buffer before each invocation. * @param tmp * A buffer used to compress the component Unicode strings. This * will be reset as necessary by this method. It will be lazily * allocated if <code>null</code>. * * @return The byte[] containing the serialized data record. This array is * newly allocated so that a series of invocations of this method * return distinct byte[]s. */ public byte[] serialize(final V val, final DataOutputBuffer out, final ByteArrayBuffer tmp) { serialize2(val, out, tmp); return out.toByteArray(); }
final DataOutput out) throws IOException { final byte termCode = getTermCode(val);
/** * Performs round trip (de-)serialization using * {@link BigdataValueSerializer#serialize()} and * {@link BigdataValueSerializer#deserialize(byte[])}. * * @param o * The {@link Value} * * @return The de-serialized {@link Value}. */ private Value roundTrip_tuned(final Value o) { return fixture.deserialize(fixture.serialize(o)); }
final BigdataValueSerializer<Value> fixture = new BigdataValueSerializer<Value>( ValueFactoryImpl.getInstance()); 97, 110, 32, 77, 99, 67, 97, 114, 116, 104, 121 }; final Value newValue = fixture.deserialize(newValBytes); final Value oldValue = fixture.deserialize(oldValBytes);
final short version = getVersion(val); serializeVersion0(val, version, out); break; case VERSION1: { serializeVersion1(val, version, out, tmp); break;
return deserializeVersion0(version, in); case VERSION1: return deserializeVersion1(version, in, tmp); default: throw new UnsupportedOperationException(ERR_VERSION + " : "
if (BigdataValueSerializer.getStringLength(val) < Short.MAX_VALUE) {
/** * Variant which permits reuse of the same buffer. This has the advantage * that the buffer is reused on each invocation and swiftly grows to its * maximum extent. * * @param val * The value. * @param out * The buffer - the caller is responsible for resetting the * buffer before each invocation. * @param tmp * A buffer used to compress the component Unicode strings. This * will be reset as necessary by this method. It will be lazily * allocated if <code>null</code>. * * @return The byte[] containing the serialized data record. This array is * newly allocated so that a series of invocations of this method * return distinct byte[]s. */ public byte[] serialize(final V val, final DataOutputBuffer out, final ByteArrayBuffer tmp) { serialize2(val, out, tmp); return out.toByteArray(); }
final DataOutput out) throws IOException { final byte termCode = getTermCode(val);
/** * Decompress and deserialize a {@link Value}. * * @param tmp * The serialized and compressed value. * * @return The {@link Value}. */ private Value getValue(final byte[] tmp) { // decompress final ByteBuffer b = compressor.decompress(tmp); final byte[] c = new byte[b.limit()]; b.get(c); // deserialize. return valSer.deserialize(c); }
/** * Return the byte[] value, which is the serialization of an RDF * {@link Value} using the {@link BigdataValueSerializer}. * * @param obj * An RDF {@link Value}. */ @Override public byte[] serializeVal(final BigdataValue obj) { return valueSer.serialize(obj, buf.reset(), tbuf); }
/** * Performs round trip (de-)serialization using * {@link BigdataValueSerializer#serialize()} and * {@link BigdataValueSerializer#deserialize(byte[])}. * * @param o * The {@link Value} * * @return The de-serialized {@link Value}. */ private Value roundTrip_tuned(final Value o) { return fixture.deserialize(fixture.serialize(o)); }