@Override protected void writeEncodedValue(final Symbol val) { final int length = val.length(); final EncoderImpl encoder = getEncoder(); for (int i = 0; i < length; i++) { encoder.writeRaw((byte) val.charAt(i)); } }
public Symbol decode(final ByteBuffer buf) { Symbol symbol = _symbolCache.get(buf); if (symbol == null) { byte[] bytes = new byte[buf.limit()]; buf.get(bytes); String str = new String(bytes, ASCII_CHARSET); symbol = Symbol.getSymbol(str); _symbolCache.put(ByteBuffer.wrap(bytes), symbol); } return symbol; }
@Override protected int getEncodedValueSize(final Symbol val) { return val.length(); }
public SymbolEncoding getEncoding(final Symbol val) { return val.length() <= 255 ? _shortSymbolEncoding : _symbolEncoding; }