public void append(final ByteArrayBuffer b, int off, int len) { if (b == null) { return; } append(b.buffer(), off, len); }
protected void flushBuffer() throws IOException { int len = this.buffer.length(); if (len > 0) { this.outstream.write(this.buffer.buffer(), 0, len); this.buffer.clear(); this.metrics.incrementBytesTransferred(len); } }
private int lineFromLineBuffer(final CharArrayBuffer charbuffer) throws IOException { // discard LF if found int l = this.linebuffer.length(); if (l > 0) { if (this.linebuffer.byteAt(l - 1) == HTTP.LF) { l--; this.linebuffer.setLength(l); } // discard CR if found if (l > 0) { if (this.linebuffer.byteAt(l - 1) == HTTP.CR) { l--; this.linebuffer.setLength(l); } } } l = this.linebuffer.length(); if (this.ascii) { charbuffer.append(this.linebuffer, 0, l); } else { // This is VERY memory inefficient, BUT since non-ASCII charsets are // NOT meant to be used anyway, there's no point optimizing it String s = new String(this.linebuffer.buffer(), 0, l, this.charset); charbuffer.append(s); } return l; }
public void append(final ByteArrayBuffer b, int off, int len) { if (b == null) { return; } append(b.buffer(), off, len); }
private static void writeBytes( final ByteArrayBuffer b, final OutputStream out) throws IOException { out.write(b.buffer(), 0, b.length()); }
public void append(final ByteArrayBuffer b, int off, int len) { if (b == null) { return; } append(b.buffer(), off, len); }
byte[] readBytes ; // Your byte array .... //for eg. readBytes = "TestBytes".getBytes(); ByteArrayBuffer mReadBuffer = new ByteArrayBuffer(0 ) ; // Instead of 0, if you know the count of expected number of bytes, nice to input here mReadBuffer.append(readBytes, 0, readBytes.length); // this copies all bytes from readBytes byte array into mReadBuffer // Any new entry of readBytes, you can just append here by repeating the same call. // Finally, if you want the result into byte[] form: byte[] result = mReadBuffer.buffer();
protected void flushBuffer() throws IOException { final int len = this.buffer.length(); if (len > 0) { this.outstream.write(this.buffer.buffer(), 0, len); this.buffer.clear(); this.metrics.incrementBytesTransferred(len); } }
protected void flushBuffer() throws IOException { final int len = this.buffer.length(); if (len > 0) { this.outstream.write(this.buffer.buffer(), 0, len); this.buffer.clear(); this.metrics.incrementBytesTransferred(len); } }
protected void flushBuffer() throws IOException { int len = this.buffer.length(); if (len > 0) { this.outstream.write(this.buffer.buffer(), 0, len); this.buffer.clear(); this.metrics.incrementBytesTransferred(len); } }
protected void flushBuffer() throws IOException { final int len = this.buffer.length(); if (len > 0) { this.outstream.write(this.buffer.buffer(), 0, len); this.buffer.clear(); this.metrics.incrementBytesTransferred(len); } }
protected void flushBuffer() throws IOException { final int len = this.buffer.length(); if (len > 0) { this.outstream.write(this.buffer.buffer(), 0, len); this.buffer.clear(); this.metrics.incrementBytesTransferred(len); } }
protected void flushBuffer() throws IOException { int len = this.buffer.length(); if (len > 0) { this.outstream.write(this.buffer.buffer(), 0, len); this.buffer.clear(); this.metrics.incrementBytesTransferred(len); } }
protected void flushBuffer() throws IOException { int len = this.buffer.length(); if (len > 0) { this.outstream.write(this.buffer.buffer(), 0, len); this.buffer.clear(); this.metrics.incrementBytesTransferred(len); } }
private void flushBuffer() throws IOException { final int len = this.buffer.length(); if (len > 0) { streamWrite(this.buffer.buffer(), 0, len); this.buffer.clear(); this.metrics.incrementBytesTransferred(len); } }
private void flushBuffer() throws IOException { final int len = this.buffer.length(); if (len > 0) { streamWrite(this.buffer.buffer(), 0, len); this.buffer.clear(); this.metrics.incrementBytesTransferred(len); } }
private void flushBuffer() throws IOException { final int len = this.buffer.length(); if (len > 0) { streamWrite(this.buffer.buffer(), 0, len); this.buffer.clear(); this.metrics.incrementBytesTransferred(len); } }
private void flushBuffer() throws IOException { final int len = this.buffer.length(); if (len > 0) { streamWrite(this.buffer.buffer(), 0, len); this.buffer.clear(); this.metrics.incrementBytesTransferred(len); } }
public void onChar(int c) { if (c=='\n' || c=='\r') { if (lineSoFar.length() > 0) { //suppress blank lines, so that we can treat either newline char as a line separator //(eg to show curl updates frequently) onLine(lineSoFar.buffer(), lineSoFar.length()); clearLineSoFar(); } } else { lineSoFar.append(c); } }
@Override public void flush() throws IOException { try { if (lineSoFar.length() > 0) { onLine(lineSoFar.buffer(), lineSoFar.length()); clearLineSoFar(); } } finally { super.flush(); } }