ByteArrayBuffer buffer - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for ByteArrayBuffer buffer method.

This code example shows how to use the following methods:append, buffer, capacity, clear, length
            this.outstream.flush();
        } 
    } 
 
    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 flush() throws IOException { 
        flushBuffer(); 
        flushStream(); 
    } 
 
    public void write(final byte[] b, final int off, final int len) throws IOException {
        if (b == null) {

6
CodeRank
This code example shows how to use the following methods:append, buffer, length
 
 
    private static ByteArrayBuffer encode(
            final Charset charset, final String string) {
        ByteBuffer encoded = charset.encode(CharBuffer.wrap(string));
        ByteArrayBuffer bab = new ByteArrayBuffer(encoded.remaining());
        bab.append(encoded.array(), encoded.position(), encoded.remaining());
        return bab;
    } 
 
 
    public static void writeBytes( 
            final ByteArrayBuffer b, final OutputStream out) throws IOException {
        out.write(b.buffer(), 0, b.length());
    } 
 
    public static void writeBytes( 
            final String s, final Charset charset, final OutputStream out) throws IOException {
        ByteArrayBuffer b = encode(charset, s);
        writeBytes(b, out);
5
CodeRank