/** * Implementation depends on {@link InputStream#available()} */ @Override public Decoder getDecoder(final InputStream is) { return new KeyValueDecoder(is); }
@Override public Encoder getEncoder(OutputStream os) { return new MessageEncoder(os); } }
@Override public Encoder getEncoder(OutputStream os) { return new KeyValueEncoder(os); } }
@Override public boolean advance() throws IOException { int firstByte = in.read(); if (firstByte == -1) { return false; } else { ((PBIS)in).unread(firstByte); } try { this.current = parseCell(); } catch (IOException ioEx) { ((PBIS)in).resetBuf(1); // reset the buffer in case the underlying stream is read from upper layers rethrowEofException(ioEx); } return true; }
public static void main(String[] args) throws IOException { // How many Cells to encode/decode on each cycle. final int count = 100000; // How many times to do an operation; repeat gives hotspot chance to warm up. final int cycles = 30; Cell [] cells = getCells(count); int size = getRoughSize(cells); int initialBufferSize = 2 * size; // Multiply by 2 to ensure we don't have to grow buffer // Test KeyValue codec. doCodec(new KeyValueCodec(), cells, cycles, count, initialBufferSize); doCodec(new CellCodec(), cells, cycles, count, initialBufferSize); doCodec(new MessageCodec(), cells, cycles, count, initialBufferSize); } }
@Override public Encoder getEncoder(OutputStream os) { return new CellEncoder(os); } }
/** * Implementation depends on {@link InputStream#available()} */ @Override public Decoder getDecoder(final InputStream is) { return new KeyValueDecoder(is); }
@Override public Encoder getEncoder(OutputStream os) { return new CellEncoder(os); } }
@Override public Encoder getEncoder(OutputStream os) { return new KeyValueEncoder(os); }
@Override public Decoder getDecoder(InputStream is) { return new CellDecoder(is); }
@Override public Decoder getDecoder(InputStream is) { return new CellDecoder(is); }
protected void checkFlushed() throws CodecException { if (this.flushed) throw new CodecException("Flushed; done"); }
public BaseDecoder(final InputStream in) { this.in = new PBIS(in, 1); }
@Override public Decoder getDecoder(ByteBuff buf) { return new ByteBuffKeyValueDecoder(buf); } }
@Override public Decoder getDecoder(InputStream is) { return new MessageDecoder(is); }
@Override public Decoder getDecoder(ByteBuff buf) { return new ByteBuffKeyValueDecoder(buf); }
@Override public Decoder getDecoder(ByteBuff buf) { return getDecoder(new ByteBuffInputStream(buf)); }
@Override public Decoder getDecoder(ByteBuff buf) { return getDecoder(new ByteBuffInputStream(buf)); }
@Override public Decoder getDecoder(ByteBuff buf) { return getDecoder(new ByteBuffInputStream(buf)); }
@Override public Decoder getDecoder(InputStream is) { return (compression == null) ? new KeyValueCodecWithTags.KeyValueDecoder(is) : new CompressedKvDecoder(is, compression); }