void append(ByteBuffer b) { if (buffer == null) { buffer = ByteBuffer.allocate(b.remaining()); buffer.flip(); } int newSize = buffer.limit() + b.remaining(); buffer = Utils.appendBuffers(buffer, b, newSize, 50); } }
void resize() { int increment = sslEngine.getSession().getPacketBufferSize(); int newSize = buffer.position() + increment; ByteBuffer newBuffer = ByteBuffer.allocate(newSize); buffer.flip(); newBuffer.flip(); buffer = Utils.appendBuffers(newBuffer, buffer, newBuffer.limit(), 50); buffer.compact(); }
void appendData(ByteBuffer data) throws ParseException { if (buffer == null) { // parser was already destroyed. return; } int responseEndPosition = getEndPosition(data); if (responseEndPosition == -1) { checkResponseSize(data); buffer = Utils.appendBuffers(buffer, data, BUFFER_MAX_SIZE, BUFFER_STEP_SIZE); return; } int limit = data.limit(); data.limit(responseEndPosition + 1); checkResponseSize(data); buffer = Utils.appendBuffers(buffer, data, BUFFER_MAX_SIZE, BUFFER_STEP_SIZE); data.limit(limit); data.position(responseEndPosition + 1); complete = true; }
data = Utils.appendBuffers(buffer, data, incomingBufferSize, BUFFER_STEP_SIZE); } else { int newSize = data.remaining(); : roundedSize); result.flip(); data = Utils.appendBuffers(result, data, incomingBufferSize, BUFFER_STEP_SIZE);
data = Utils.appendBuffers(buffer, data, incomingBufferSize, BUFFER_STEP_SIZE); } else { int newSize = data.remaining(); : roundedSize); result.flip(); data = Utils.appendBuffers(result, data, incomingBufferSize, BUFFER_STEP_SIZE);
data = Utils.appendBuffers(buffer, data, incomingBufferSize, BUFFER_STEP_SIZE); } else { int newSize = data.remaining(); ByteBuffer.allocate(roundedSize > incomingBufferSize ? newSize : roundedSize); result.flip(); data = Utils.appendBuffers(result, data, incomingBufferSize, BUFFER_STEP_SIZE);
data = Utils.appendBuffers(buffer, data, incomingBufferSize, BUFFER_STEP_SIZE); } else { int newSize = data.remaining(); ByteBuffer.allocate(roundedSize > incomingBufferSize ? newSize : roundedSize); result.flip(); data = Utils.appendBuffers(result, data, incomingBufferSize, BUFFER_STEP_SIZE);