@Override public void flush() throws IOException { out.flush(); this.flushed = true; }
ByteBufOutputStream out = new ByteBufOutputStream(byteBuf); entity.writeTo(out); out.flush(); out.close(); uriRequest = new DefaultFullHttpRequest(
@Override public void flush() throws IOException { out.flush(); this.flushed = true; }
@Override public ByteBuf encode(final Object in) throws IOException { if (in instanceof GeoWaveRedisPersistedRow) { final GeoWaveRedisPersistedRow row = (GeoWaveRedisPersistedRow) in; final ByteBuf buf = ByteBufAllocator.DEFAULT.buffer(); try (final ByteBufOutputStream out = new ByteBufOutputStream(buf)) { encodeRow(out, row, visibilityEnabled); out.flush(); return out.buffer(); } } throw new IOException("Encoder only supports GeoWaveRedisRow"); } };
output.flush(); output.close();
protected ResourceState toResourceState(HttpEntity entity, MediaType contentType) throws Exception { ByteBuf buffer = Unpooled.buffer(); ByteBufOutputStream out = new ByteBufOutputStream(buffer); entity.writeTo(out); out.flush(); out.close(); return this.system.codecManager().decode(contentType, buffer); }
@SneakyThrows(IOException.class) private void writeMessage(AppendBlock block, ByteBuf out) { int startIdx = out.writerIndex(); ByteBufOutputStream bout = new ByteBufOutputStream(out); bout.writeInt(block.getType().getCode()); bout.write(LENGTH_PLACEHOLDER); block.writeFields(bout); bout.flush(); bout.close(); int endIdx = out.writerIndex(); int fieldsSize = endIdx - startIdx - TYPE_PLUS_LENGTH_SIZE; out.setInt(startIdx + TYPE_SIZE, fieldsSize + currentBlockSize); }
@SneakyThrows(IOException.class) private int writeMessage(WireCommand msg, ByteBuf out) { int startIdx = out.writerIndex(); ByteBufOutputStream bout = new ByteBufOutputStream(out); bout.writeInt(msg.getType().getCode()); bout.write(LENGTH_PLACEHOLDER); msg.writeFields(bout); bout.flush(); bout.close(); int endIdx = out.writerIndex(); int fieldsSize = endIdx - startIdx - TYPE_PLUS_LENGTH_SIZE; out.setInt(startIdx + TYPE_SIZE, fieldsSize); return endIdx - startIdx; }
@Override public ByteBuf encode(final Object in) throws IOException { if (in instanceof GeoWaveRedisPersistedTimestampRow) { final GeoWaveRedisPersistedTimestampRow row = (GeoWaveRedisPersistedTimestampRow) in; final ByteBuf buf = ByteBufAllocator.DEFAULT.buffer(); try (final ByteBufOutputStream out = new ByteBufOutputStream(buf)) { GeoWaveRedisRowCodec.encodeRow(out, row, visibilityEnabled); Varint.writeSignedVarInt((int) row.getSecondsSinceEpic(), out); Varint.writeSignedVarInt(row.getNanoOfSecond(), out); out.flush(); return out.buffer(); } } throw new IOException("Encoder only supports GeoWaveRedisPersistedTimestampRow"); } };
throw new IllegalStateException(e); output.flush(); output.close();
@Override protected void encode(ChannelHandlerContext ctx, Serializable msg, ByteBuf out) throws Exception { KryoContext kryoContext = kryoContextHolder.get(); Kryo kryo = kryoContext.getKryo(); Output output = kryoContext.getOut(); output.clear(); ByteBufOutputStream bout = new ByteBufOutputStream(out); int startIdx = out.writerIndex(); bout.write(LENGTH_PLACEHOLDER); output.setOutputStream(bout); output.writeByte(StreamMessageDecoder.KRYO_STREAM_VERSION); kryo.writeClassAndObject(output, msg); output.flush(); bout.flush(); bout.close(); output.close(); int endIdx = out.writerIndex(); out.setInt(startIdx, endIdx - startIdx - 4); }
ByteBufOutputStream out = new ByteBufOutputStream(byteBuf); entity.writeTo(out); out.flush(); out.close(); uriRequest = new DefaultFullHttpRequest(