Search in sources :

Example 1 with SlowInflate

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;
}
Also used : SlowInflate(com.yahoo.io.SlowInflate)

Example 2 with SlowInflate

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);
}
Also used : SlowInflate(com.yahoo.io.SlowInflate)

Example 3 with SlowInflate

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;
}
Also used : SlowInflate(com.yahoo.io.SlowInflate) JSONString(com.yahoo.prelude.hitfield.JSONString)

Example 4 with SlowInflate

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));
}
Also used : SlowInflate(com.yahoo.io.SlowInflate)

Aggregations

SlowInflate (com.yahoo.io.SlowInflate)4 JSONString (com.yahoo.prelude.hitfield.JSONString)1