public final class ByteOutputStream extends OutputStream
BufferedOutputStream
.
Compared to BufferedOutputStream
,
this class:
Modifier and Type | Field and Description |
---|---|
protected byte[] |
buf
The buffer where data is stored.
|
protected int |
count
The number of valid bytes in the buffer.
|
Constructor and Description |
---|
ByteOutputStream() |
ByteOutputStream(int size) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
byte[] |
getBytes() |
int |
getCount() |
ByteInputStream |
newInputStream() |
void |
reset() |
int |
size() |
byte[] |
toByteArray()
Deprecated.
because this is evil!
|
String |
toString()
Converts the buffer's contents into a string, translating bytes into
characters according to the platform's default character encoding.
|
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(InputStream in)
Copies all the bytes from this input into this buffer.
|
void |
write(int b) |
void |
writeAsAscii(String s)
Writes a string as ASCII string.
|
void |
writeTo(OutputStream out) |
flush
protected byte[] buf
protected int count
public ByteOutputStream()
public ByteOutputStream(int size)
public void write(InputStream in) throws IOException
in
- input stream.IOException
- in case of an I/O error.public void write(int b)
write
in class OutputStream
public void write(byte[] b, int off, int len)
write
in class OutputStream
public void write(byte[] b)
write
in class OutputStream
public void writeAsAscii(String s)
s
- string to write.public void writeTo(OutputStream out) throws IOException
IOException
public void reset()
@Deprecated public byte[] toByteArray()
public int size()
public ByteInputStream newInputStream()
public String toString()
public void close()
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
public byte[] getBytes()
public int getCount()
Copyright © 2021 JBoss by Red Hat. All rights reserved.