API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.io. ByteArrayOutputStream View Source
Author(s)
Arthur van Hoff
Since
JDK1.0
Version
1.53, 06/07/06
Serial
Hierarchy
 Object
      OutputStream
          ByteArrayOutputStream
Implements
Subclasses
Description
public class ByteArrayOutputStream
  This class implements an output stream in which the data is written into a byte array.
See also:   
Constructors
public ByteArrayOutputStream ()
  Creates a new byte array output stream.
public ByteArrayOutputStream (int size)
  Creates a new byte array output stream, with a buffer capacity of the specified size, in bytes.
Methods
Hide/Show inherited methods
public void close () throws IOException [Overrides OutputStream]
  Closing a ByteArrayOutputStream has no effect.
public void flush () throws IOException [Inherited From OutputStream]
  Flushes this output stream and forces any buffered output bytes to be written out.
publicsynchronized void reset ()
  Resets the count field of this byte array output stream to zero, so that all currently accumulated output in the output stream is discarded.
publicsynchronized int size ()
  Returns the current size of the buffer.
publicsynchronized byte toByteArray ()
  Creates a newly allocated byte array.
publicsynchronized String toString ()
  Converts the buffer's contents into a string decoding bytes using the platform's default character set.
@Deprecated
publicsynchronized String toString (int hibyte)
  Creates a newly allocated string.
publicsynchronized String toString (String charsetName) throws UnsupportedEncodingException
  Converts the buffer's contents into a string by decoding the bytes using the specified charsetName.
public void write (byte[] b) throws IOException [Inherited From OutputStream]
  Writes b.length bytes from the specified byte array to this output stream.
publicsynchronized void write (byte[] b, int off, int len) [Overrides OutputStream]
  Writes len bytes from the specified byte array starting at offset off to this byte array output stream.
publicsynchronized void write (int b) [Specified in OutputStream]
  Writes the specified byte to this byte array output stream.
publicsynchronized void writeTo (OutputStream out) throws IOException
  Writes the complete contents of this byte array output stream to the specified output stream argument, as if by calling the output stream's write method using out.write(buf, 0, count).
Fields
protected byte buf
The buffer where data is stored.
protected int count
The number of valid bytes in the buffer.
Nested Classes
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar