@InterfaceAudience.Private public class ByteArrayOutputStream extends OutputStream implements ByteBufferWriter
| Constructor and Description |
|---|
ByteArrayOutputStream() |
ByteArrayOutputStream(int capacity) |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getBuffer() |
void |
reset()
Resets the
pos field of this byte array output stream to zero. |
int |
size() |
byte[] |
toByteArray()
Copies the content of this Stream into a new byte array.
|
void |
write(byte[] b,
int off,
int len) |
void |
write(ByteBuffer b,
int off,
int len)
Writes
len bytes from the specified ByteBuffer starting at offset off |
void |
write(int b) |
void |
writeInt(int i)
Writes an
int to the underlying output stream as four bytes, high byte first. |
close, flush, writepublic ByteArrayOutputStream()
public ByteArrayOutputStream(int capacity)
public void write(ByteBuffer b, int off, int len)
ByteBufferWriterlen bytes from the specified ByteBuffer starting at offset offwrite in interface ByteBufferWriterb - the data.off - the start offset in the data.len - the number of bytes to write.public void writeInt(int i)
ByteBufferWriterint to the underlying output stream as four bytes, high byte first.writeInt in interface ByteBufferWriteri - the int to writepublic void write(int b)
write in class OutputStreampublic void write(byte[] b,
int off,
int len)
write in class OutputStreampublic void reset()
pos field of this byte array output stream to zero. The output stream
can be used again.public byte[] toByteArray()
public byte[] getBuffer()
public int size()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.