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
Customized BufferedOutputStream.

Compared to BufferedOutputStream, this class:

  1. doesn't do synchronization
  2. allows access to the raw buffer
  3. almost no parameter check
  • Constructor Details

    • ByteOutputStream

      public ByteOutputStream()
    • ByteOutputStream

      public ByteOutputStream(int size)
  • Method Details

    • 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 class OutputStream
    • write

      public void write(byte[] b, int off, int len)
      Overrides:
      write in class OutputStream
    • write

      public void write(byte[] b)
      Overrides:
      write in class OutputStream
    • 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.
      Overrides:
      toString in class Object
      Returns:
      String translated from the buffer's contents.
      Since:
      JDK1.1
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class OutputStream
    • getBytes

      public byte[] getBytes()
    • getCount

      public int getCount()