Dave's Brain

Browse - Programming Tips - org.apache.http.util.ByteArrayBuffer was removed in SDK23, what can I use instead?

Date: 2017apr4
OS: Android
Language: Java

Q.  org.apache.http.util.ByteArrayBuffer was removed in SDK23, what can I use instead?

A. Use ByteArrayOutputStream

// Create old = new ByteArrayBuffer() => newer = new ByteArrayOutputStream()
// How many bytes? old.length() => newer.count()
// Delete all old.setLength(0) => newer.reset()
// Get all bytes old.buffer() => newer.toByteArray()
// Add some bytes old.append(buf, 0, len) => newer.write(buf, 0, len)

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.