public boolean isEmpty() { return writeBufferRemaining == 0 && (nextWriteBuffer==null || nextWriteBuffer.size() == 0); }
public static String propertiesToString(Properties props) throws IOException { String result = ""; if (props != null) { DataByteArrayOutputStream dataOut = new DataByteArrayOutputStream(); props.store(dataOut, ""); result = new String(dataOut.getData(), 0, dataOut.size()); dataOut.close(); } return result; }
public static String propertiesToString(Properties props) throws IOException { String result = ""; if (props != null) { DataByteArrayOutputStream dataOut = new DataByteArrayOutputStream(); props.store(dataOut, ""); result = new String(dataOut.getData(), 0, dataOut.size()); dataOut.close(); } return result; }
protected void writeDirect(ByteBuffer value) throws IOException { // is the direct buffer small enough to just fit into the nextWriteBuffer? int nextnextPospos = nextWriteBuffer.position(); int valuevalueLengthlength = value.remaining(); int available = nextWriteBuffer.getData().length - nextnextPospos; if (available > valuevalueLengthlength) { value.get(nextWriteBuffer.getData(), nextnextPospos, valuevalueLengthlength); nextWriteBuffer.position(nextnextPospos + valuevalueLengthlength); } else { if (nextWriteBuffer!=null && nextWriteBuffer.size() != 0) { flushNextWriteBuffer(); } writeBuffer.add(value); writeBufferRemaining += value.remaining(); } }
if (nextWriteBuffer==null || nextWriteBuffer.size() == 0) { if( writeBufferPool!=null && nextWriteBuffer!=null ) { writeBufferPool.checkin(nextWriteBuffer.getData());
public ProtocolCodec.BufferState write(Object value) throws IOException { if (full()) { return ProtocolCodec.BufferState.FULL; } else { boolean wasEmpty = isEmpty(); if( nextWriteBuffer == null ) { nextWriteBuffer = allocateNextWriteBuffer(); } encode(value); if (nextWriteBuffer.size() >= (writeBufferSize* 0.75)) { flushNextWriteBuffer(); } if (wasEmpty) { return ProtocolCodec.BufferState.WAS_EMPTY; } else { return ProtocolCodec.BufferState.NOT_EMPTY; } } }