@Override public void write(int b) throws IOException { final byte[] buffer = new byte[1]; buffer[0] = (byte) b; delegate.feed(Buffers.wrap(MemoryManager.DEFAULT_MEMORY_MANAGER, buffer), false); }
@Override public void write(byte[] b, int off, int len) throws IOException { delegate.feed(Buffers.wrap(MemoryManager.DEFAULT_MEMORY_MANAGER, b, off, len), false); }
@Override public void write(byte[] b) throws IOException { delegate.feed(Buffers.wrap(MemoryManager.DEFAULT_MEMORY_MANAGER, b), false); }
final byte[] data = sb.toString().getBytes(charset); final MemoryManager mm = ctx.getMemoryManager(); final Buffer gBuffer = Buffers.wrap(mm, data); final HttpContent content = requestPacket.httpContentBuilder() .content(gBuffer)
@SuppressWarnings({"unchecked"}) public boolean generate(final FilterChainContext ctx, final Request request, final HttpRequestPacket requestPacket) throws IOException { String charset = request.getBodyEncoding(); if (charset == null) { charset = Charsets.ASCII_CHARSET.name(); } final byte[] data = request.getStringData().getBytes(charset); final MemoryManager mm = ctx.getMemoryManager(); final Buffer gBuffer = Buffers.wrap(mm, data); if (requestPacket.getContentLength() == -1) { requestPacket.setContentLengthLong(data.length); } final HttpContent content = requestPacket.httpContentBuilder() .content(gBuffer) .last(true) .build(); ctx.write(content, ((!requestPacket.isCommitted()) ? ctx.getTransportContext().getCompletionHandler() : null)); return true; }
b = Buffers.wrap(mm, buf, 0, read);
@SuppressWarnings({"unchecked"}) public boolean generate(final FilterChainContext ctx, final Request request, final HttpRequestPacket requestPacket) throws IOException { final MemoryManager mm = ctx.getMemoryManager(); final byte[] data = request.getByteData(); final Buffer gBuffer = Buffers.wrap(mm, data); if (requestPacket.getContentLength() == -1) { requestPacket.setContentLengthLong(data.length); } final HttpContent content = requestPacket.httpContentBuilder() .content(gBuffer) .last(true) .build(); ctx.write(content, ((!requestPacket.isCommitted()) ? ctx.getTransportContext().getCompletionHandler() : null)); return true; }
private void flushBufferedData() { if (buffer.size() == 0) { // buffer is empty return; } Buffer message = Buffers.wrap(grizzlyConnection.getMemoryManager(), buffer.toByteArray()); grizzlyConnection.write(message); buffer.reset(); } }
private void flushBufferedData() { if (buffer.size() == 0) { // buffer is empty return; } Buffer message = Buffers.wrap(grizzlyConnection.getMemoryManager(), buffer.toByteArray()); grizzlyConnection.write(message); buffer.reset(); } }
public void allocate(final int size) { if (isNull() || (limit - start) < size) { setBufferChunk(Buffers.wrap(null, new byte[size]), 0, 0, size); } end = start; }
/** * Sets the status and reason phrase on the specified response. * @param response the response to set the status and reason phrase on. */ public void setValues(final HttpResponsePacket response) { response.setStatus(this); response.setReasonPhrase(Buffers.wrap(null, reasonPhraseBytes)); } }
/** * {@inheritDoc} */ @Override public void writeByteArray(byte[] data, int offset, int length) throws IOException { final Buffer buffer = Buffers.wrap(connection.getMemoryManager(), data, offset, length); output.write(buffer); }
public void allocate(final int size) { if (isNull() || (limit - start) < size) { setBufferChunk(Buffers.wrap(null, new byte[size]), 0, 0, size); } end = start; }
/** * {@inheritDoc} */ @Override public void writeByteArray(byte[] data, int offset, int length) throws IOException { final Buffer buffer = Buffers.wrap(connection.getMemoryManager(), data, offset, length); output.write(buffer); }
/** * Sets the status and reason phrase on the specified response. * @param response the response to set the status and reason phrase on. */ public void setValues(final HttpResponsePacket response) { response.setStatus(this); response.setReasonPhrase(Buffers.wrap(null, reasonPhraseBytes)); } }
/** * {@inheritDoc} */ @Override public void writeByteArray(byte[] data, int offset, int length) throws IOException { final Buffer buffer = Buffers.wrap(connection.getMemoryManager(), data, offset, length); output.write(buffer); }
/** * Sets the status and reason phrase on the specified response. * @param response the response to set the status and reason phrase on. */ public void setValues(final HttpResponsePacket response) { response.setStatus(this); response.setReasonPhrase(Buffers.wrap(null, reasonPhraseBytes)); } }
/** * Sets the status and reason phrase on the specified response. * @param response the response to set the status and reason phrase on. */ public void setValues(final HttpResponsePacket response) { response.setStatus(this); response.setReasonPhrase(Buffers.wrap(null, reasonPhraseBytes)); } }
@Override public void replayPayload(byte[] payloadByteArray) { if (payloadByteArray == null) { return; } coyoteRequest.replayPayload(Buffers.wrap( coyoteRequest.getContext().getMemoryManager(), payloadByteArray)); }
@SuppressWarnings("unchecked") protected void sendRaw(byte[] rawData) { final Connection connection = protocolHandler.getConnection(); final MemoryManager mm = connection.getTransport().getMemoryManager(); final Buffer buffer = Buffers.wrap(mm, rawData); buffer.allowBufferDispose(false); connection.write(buffer); }