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)