java.lang.Object
java.io.OutputStream
com.sun.xml.messaging.saaj.util.ByteOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
Customized
BufferedOutputStream
.
Compared to BufferedOutputStream
,
this class:
- doesn't do synchronization
- allows access to the raw buffer
- almost no parameter check
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
byte[]
getBytes()
int
getCount()
void
reset()
int
size()
byte[]
Deprecated.because this is evil!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
(int b) void
write
(InputStream in) Copies all the bytes from this input into this buffer.void
Writes a string as ASCII string.void
writeTo
(OutputStream out) Methods inherited from class java.io.OutputStream
flush, nullOutputStream
-
Constructor Details
-
ByteOutputStream
public ByteOutputStream() -
ByteOutputStream
public ByteOutputStream(int size)
-
-
Method Details
-
write
Copies all the bytes from this input into this buffer.- Parameters:
in
- input stream.- Throws:
IOException
- in case of an I/O error.
-
write
public void write(int b) - Specified by:
write
in classOutputStream
-
write
public void write(byte[] b, int off, int len) - Overrides:
write
in classOutputStream
-
write
public void write(byte[] b) - Overrides:
write
in classOutputStream
-
writeAsAscii
Writes a string as ASCII string.- Parameters:
s
- string to write.
-
writeTo
- Throws:
IOException
-
reset
public void reset() -
toByteArray
Deprecated.because this is evil!Evil buffer reallocation method. Don't use it unless you absolutely have to.- Returns:
- byte array
-
size
public int size() -
newInputStream
-
toString
Converts the buffer's contents into a string, translating bytes into characters according to the platform's default character encoding. -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
-
getBytes
public byte[] getBytes() -
getCount
public int getCount()
-