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
Contextual code suggestions in your IDE  Get Codota for Java
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
Contextual code suggestions in your IDE  Get Codota for Java
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
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: append, toByteArray
 
    private byte[] cutTrail(byte[] temp, int nBytes) {
        byte[] back;
        ByteArrayBuffer bab;
 
        bab = new ByteArrayBuffer(nBytes);
        bab.append(temp, 0, nBytes);
        back = bab.toByteArray();
 
        return back;
    } 
 
    // **************************************************** // 
    // encoder 
    // **************************************************** // 
 
    /** 
     * Encoder the commander with package header and trail 
     *  
     * @param data 
Full Snippet Info
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: append
                                request.setHeader("SOAPAction",
                                        "\"http://schemas.microsoft.com/DRM/2007/03/protocols/" 
                                                + fMessageType + "\"");
                            } 
                            if (fData != null && fData.length() > 0) {
                                ByteArrayBuffer bab = new ByteArrayBuffer(fData.length());
                                bab.append(fData.getBytes(), 0, fData.length());
                                writeDataToFile("post", bab);
                                try { 
                                    request.setEntity(new StringEntity(fData));
                                } catch (UnsupportedEncodingException e) {
                                } 
                            } 
                        } 
                        return request;
                    } 
                }); 
        return response;
    } 
 
Full Snippet Info
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: byteAt, length
	{ 
		return new Point(i / width, i % width);
	} 
	public int getTextureId(int i)
	{ 
		if(i >= mGrid.length())
			return 0; 
		else 
			return mGrid.byteAt(i);
	} 
	public int getTextureId(int x,int y)
	{ 
		return getTextureId(x + (width * y));
	} 
	 
} 
Full Snippet Info
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: append, clear, toByteArray
 
	public static ByteArrayBuffer parseCommand(Rover2Controller controller, ByteArrayBuffer arrayBuffer) throws IOException 
	{ 
		Message response;
 
		byte[] buffer = arrayBuffer.toByteArray();
		try { 
			response = new CommandEncoder().new Message(buffer);
		} catch (BufferUnderflowException e) {
			return arrayBuffer;
		} 
 
		arrayBuffer.clear();
		arrayBuffer.append(buffer, response.size(), buffer.length - response.size());
 
		Log.d(TAG, "recv op:" + response.getOpCode());
		switch (response.getOpCode())
		{ 
		default: 
			return arrayBuffer;
Full Snippet Info
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: append, toByteArray
        } 
    } 
 
    private byte[] cutData(byte[] buffer, int bytes) {
        Log.d(TAG, "cutData()");
        ByteArrayBuffer bab = new ByteArrayBuffer(bytes);
 
        bab.append(buffer, 0, bytes);
        return bab.toByteArray();
    } 
 
    public void splitToSend(byte[] buffer, String frequency) {
 
        String tempfrequency = " 38 ";
        int counter = 0;
 
        // setting split parts 
        int parts = 5;
        Log.d(TAG, "buffer length= " + buffer.length);
        if ((buffer.length) > 200 && (buffer.length < 300)) {
Full Snippet Info
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Android ByteArrayBuffer Questions & Answers:

See Code Examples for Android ByteArrayBuffer Methods: