Package com.sun.xml.messaging.saaj.util
Class ByteOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- com.sun.xml.messaging.saaj.util.ByteOutputStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public final class ByteOutputStream extends OutputStream
CustomizedBufferedOutputStream
.Compared to
BufferedOutputStream
, this class:- doesn't do synchronization
- allows access to the raw buffer
- almost no parameter check
-
-
Constructor Summary
Constructors Constructor Description ByteOutputStream()
ByteOutputStream(int size)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method 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(int b)
void
write(InputStream in)
Copies all the bytes from this input into this buffer.void
writeAsAscii(String s)
Writes a string as ASCII string.void
writeTo(OutputStream out)
-
Methods inherited from class java.io.OutputStream
flush, nullOutputStream
-
-
-
-
Method Detail
-
write
public void write(InputStream in) throws IOException
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
public void writeAsAscii(String s)
Writes a string as ASCII string.- Parameters:
s
- string to write.
-
writeTo
public void writeTo(OutputStream out) throws IOException
- Throws:
IOException
-
reset
public void reset()
-
toByteArray
@Deprecated public byte[] 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
public ByteInputStream newInputStream()
-
toString
public String 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()
-
-