Class StandardSerializer

All Implemented Interfaces:
Closeable, AutoCloseable
Direct Known Subclasses:
CsvDirectSerializer, CsvXQuerySerializer, JsonSerializer, XMLSerializer

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

    • form

      protected final Normalizer.Form form
      Normalization form.
    • sep

      protected boolean sep
      Include separator.
    • atomic

      protected boolean atomic
      Atomic flag.
  • Constructor Details

  • Method Details

    • serialize

      public void serialize(Item item) throws IOException
      Description copied from class: Serializer
      Serializes the specified item, which may be a node or an atomic value.
      Overrides:
      serialize in class Serializer
      Parameters:
      item - item to be serialized
      Throws:
      IOException - I/O exception
    • reset

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

      protected void node(ANode node) throws IOException
      Description copied from class: Serializer
      Serializes the specified node.
      Overrides:
      node in class Serializer
      Parameters:
      node - node to be serialized
      Throws:
      IOException - I/O exception
    • function

      protected void function(FItem item) throws IOException
      Description copied from class: Serializer
      Serializes a function item.
      Overrides:
      function in class Serializer
      Parameters:
      item - item
      Throws:
      IOException - I/O exception
    • atomic

      protected void atomic(Item item) throws IOException
      Description copied from class: Serializer
      Serializes an atomic value.
      Overrides:
      atomic in class Serializer
      Parameters:
      item - item
      Throws:
      IOException - I/O exception
    • printChar

      protected final void printChar(int cp) throws IOException
      Description copied from class: OutputSerializer
      Encodes and prints a character.
      Specified by:
      printChar in class OutputSerializer
      Parameters:
      cp - codepoint to be printed
      Throws:
      IOException - I/O exception
    • print

      protected void print(int cp) throws IOException
      Prints a single character.
      Parameters:
      cp - codepoint
      Throws:
      IOException - I/O exception
    • norm

      protected final byte[] norm(byte[] text)
      Normalizes the specified text.
      Parameters:
      text - text to be normalized
      Returns:
      normalized text
    • characterMap

      protected final boolean characterMap(int cp) throws IOException
      Replaces a character with an entry from the character map.
      Parameters:
      cp - codepoint
      Returns:
      true if replacement was found
      Throws:
      IOException - I/O exception