Class ByteString.Output

    • Method Detail

      • write

        public void write​(byte[] b,
                          int offset,
                          int length)
        Overrides:
        write in class OutputStream
      • toByteString

        public ByteString toByteString()
        Creates a byte string with the size and contents of this output stream. This does not create a new copy of the underlying bytes. If the stream size grows dynamically, the runtime is O(log n) in respect to the number of bytes written to the ByteString.Output. If the stream size stays within the initial capacity, the runtime is O(1).
        Returns:
        the current contents of this output stream, as a byte string.
      • writeTo

        public void writeTo​(OutputStream out)
                     throws IOException
        Writes the complete contents of this byte array output stream to the specified output stream argument.
        Parameters:
        out - the output stream to which to write the data.
        Throws:
        IOException - if an I/O error occurs.
      • size

        public int size()
        Returns the current size of the output stream.
        Returns:
        the current size of the output stream
      • reset

        public void reset()
        Resets this stream, so that all currently accumulated output in the output stream is discarded. The output stream can be used again, reusing the already allocated buffer space.