use of com.yahoo.io.SlowInflate in project vespa by vespa-engine.
the class LongstringField method decode.
@Override
public Object decode(ByteBuffer b) {
long dataLen = 0;
long len = ((long) b.getInt()) & 0xffffffffL;
boolean compressed;
String field;
// if MSB is set this is a compressed field. set the compressed
// flag accordingly and decompress the data
compressed = ((len & 0x80000000) != 0);
if (compressed) {
len &= 0x7fffffff;
dataLen = b.getInt();
len -= 4;
}
byte[] tmp = new byte[(int) len];
b.get(tmp);
if (compressed) {
SlowInflate inf = new SlowInflate();
tmp = inf.unpack(tmp, (int) dataLen);
}
field = Utf8.toString(tmp);
return field;
}
use of com.yahoo.io.SlowInflate in project vespa by vespa-engine.
the class LongdataField method decode.
@Override
public Object decode(ByteBuffer b) {
long dataLen = 0;
long len = ((long) b.getInt()) & 0xffffffffL;
boolean compressed;
// if MSB is set this is a compressed field. set the compressed
// flag accordingly and decompress the data
compressed = ((len & 0x80000000) != 0);
if (compressed) {
len &= 0x7fffffff;
dataLen = b.getInt();
len -= 4;
}
byte[] tmp = new byte[(int) len];
b.get(tmp);
if (compressed) {
SlowInflate inf = new SlowInflate();
tmp = inf.unpack(tmp, (int) dataLen);
}
return convert(tmp);
}
use of com.yahoo.io.SlowInflate in project vespa by vespa-engine.
the class JSONField method decode.
@Override
public Object decode(ByteBuffer b) {
long dataLen = 0;
long len = ((long) b.getInt()) & 0xffffffffL;
boolean compressed;
JSONString field;
// if MSB is set this is a compressed field. set the compressed
// flag accordingly and decompress the data
compressed = ((len & 0x80000000) != 0);
if (compressed) {
len &= 0x7fffffff;
dataLen = b.getInt();
len -= 4;
}
byte[] tmp = new byte[(int) len];
b.get(tmp);
if (compressed) {
SlowInflate inf = new SlowInflate();
tmp = inf.unpack(tmp, (int) dataLen);
}
field = new JSONString(Utf8.toString(tmp));
return field;
}
use of com.yahoo.io.SlowInflate in project vespa by vespa-engine.
the class XMLField method decode.
@Override
public Object decode(ByteBuffer b) {
long dataLen = 0;
long len = ((long) b.getInt()) & 0xffffffffL;
boolean compressed;
// if MSB is set this is a compressed field. set the compressed
// flag accordingly and decompress the data
compressed = ((len & 0x80000000) != 0);
if (compressed) {
len &= 0x7fffffff;
dataLen = b.getInt();
len -= 4;
}
byte[] tmp = new byte[(int) len];
b.get(tmp);
if (compressed) {
SlowInflate inf = new SlowInflate();
tmp = inf.unpack(tmp, (int) dataLen);
}
return convert(Utf8.toString(tmp));
}
Aggregations