Class OutputSerializer

java.lang.Object
org.basex.io.serial.Serializer
org.basex.io.serial.OutputSerializer
All Implemented Interfaces:
Closeable, AutoCloseable
Direct Known Subclasses:
AdaptiveSerializer, StandardSerializer

public abstract class OutputSerializer extends Serializer
This class serializes items to an output stream.
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Field Details

    • out

      protected final PrintOutput out
      Output stream.
    • sopts

      protected final SerializerOptions sopts
      Serializer options.
    • encoding

      protected final String encoding
      Encoding.
    • itemsep

      protected byte[] itemsep
      Item separator.
  • Constructor Details

  • Method Details

    • reset

      public void reset()
      Description copied from class: Serializer
      Resets the serializer (indentation, etc).
      Overrides:
      reset in class Serializer
    • finished

      public final boolean finished()
      Description copied from class: Serializer
      Tests if the serialization was interrupted.
      Overrides:
      finished in class Serializer
      Returns:
      result of check
    • close

      public void close() throws IOException
      Description copied from class: Serializer
      Closes the serializer.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class Serializer
      Throws:
      IOException - I/O exception
    • indent

      protected void indent() throws IOException
      Prints indentation whitespaces.
      Throws:
      IOException - I/O exception
    • separate

      protected boolean separate() throws IOException
      Prints an item separator.
      Returns:
      boolean indicating if separator was printed
      Throws:
      IOException - I/O exception
    • printChars

      protected final void printChars(byte[] text) throws IOException
      Encodes and prints characters.
      Parameters:
      text - characters to be printed
      Throws:
      IOException - I/O exception
    • printChar

      protected abstract void printChar(int cp) throws IOException
      Encodes and prints a character.
      Parameters:
      cp - codepoint to be printed
      Throws:
      IOException - I/O exception
    • printHex

      protected final void printHex(int cp) throws IOException
      Returns a hex entity for the specified codepoint.
      Parameters:
      cp - codepoint
      Throws:
      IOException - I/O exception