示例#1
0
    @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));
      }
    }
示例#2
0
        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;
        }
示例#3
0
 @Override
 protected int getEncodedValueSize(final Symbol val) {
   return val.length();
 }
示例#4
0
 public SymbolEncoding getEncoding(final Symbol val) {
   return val.length() <= 255 ? _shortSymbolEncoding : _symbolEncoding;
 }