Class PosterOutputStream

  • All Implemented Interfaces:
    Closeable, Flushable, AutoCloseable

    public class PosterOutputStream
    extends ByteArrayOutputStream
    Instances of this class are returned to applications for the purpose of sending user data for a HTTP POST or PUT request. This class is used when the content-length will be specified in the header of the request. The semantics of ByteArrayOutputStream are extended so that when close() is called, it is no longer possible to write additional data to the stream. From this point the content length of the request is fixed and cannot change.
    • Constructor Detail

      • PosterOutputStream

        public PosterOutputStream()
        Creates a new output stream for POST user data
    • Method Detail

      • write

        public void write​(int b)
        Writes the specified byte to this output stream.
        Overrides:
        write in class ByteArrayOutputStream
        Parameters:
        b - the byte to be written.
      • write

        public void write​(byte[] b,
                          int off,
                          int len)
        Writes len bytes from the specified byte array starting at offset off to this output stream.
        Overrides:
        write in class ByteArrayOutputStream
        Parameters:
        b - the data.
        off - the start offset in the data.
        len - the number of bytes to write.
      • reset

        public void reset()
        Resets the count field of this output stream to zero, so that all currently accumulated output in the ouput stream is discarded. The output stream can be used again, reusing the already allocated buffer space. If the output stream has been closed, then this method has no effect.
        Overrides:
        reset in class ByteArrayOutputStream
        See Also:
        ByteArrayInputStream.count