Android ByteArrayBuffer - top ranked examples from Open Source projects

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

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
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: append, toByteArray
This code example shows how to use the following methods: append, toByteArray
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);
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: append, toByteArray
 
  //put body together and return it 
  public byte[] getContent() throws UnsupportedEncodingException 
  { 
    // create new byte array buffer and get start and end as byte arrays 
    ByteArrayBuffer endBuffer = new ByteArrayBuffer(0);
    byte[] start              = buffer.toByteArray();
    byte[] end                = (boundary+DASHES).getBytes(HTTP.DEFAULT_CONTENT_CHARSET);
 
    // append the start and end to new byte array buffer 
    endBuffer.append(start, 0, start.length);
    endBuffer.append(end, 0, end.length);
 
    // return buffer as content 
    return endBuffer.toByteArray();
  } 
 
  //create start of the body 
  private String createStart(String contentType)
  { 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android ByteArrayBuffer Questions & Answers:

See Code Examples for Android ByteArrayBuffer Methods: