Class ArrayOutput

All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public final class ArrayOutput extends PrintOutput
This class caches the output bytes in an array, similar to ByteArrayOutputStream. This implementation is faster because functions are not synchronized.
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Constructor Details

    • ArrayOutput

      public ArrayOutput()
      Constructor.
  • Method Details

    • write

      public void write(int b)
      Overrides:
      write in class PrintOutput
    • toArray

      public byte[] toArray()
      Returns the output as byte array.
      Returns:
      byte array
    • next

      public byte[] next()
      Returns an array with all elements and resets the internal buffer.
      Returns:
      array
    • finish

      public byte[] finish()
      Returns the output as byte array, and invalidates the internal array. Warning: the function must only be called if the output stream is discarded afterwards.
      Returns:
      token
    • buffer

      public byte[] buffer()
      Returns the internal buffer.
      Returns:
      buffer
    • reset

      public void reset()
      Resets the internal buffer.
    • toString

      public String toString()
      Overrides:
      toString in class Object