Class FSAHeader


  • public final class FSAHeader
    extends java.lang.Object
    Standard FSA file header, as described in fsa package documentation.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) static int FSA_MAGIC
      FSA magic (4 bytes).
      (package private) static int MAX_HEADER_LENGTH
      Maximum length of the header block.
      (package private) byte version
      FSA version number.
    • Constructor Summary

      Constructors 
      Constructor Description
      FSAHeader​(byte version)  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static FSAHeader read​(java.io.InputStream in)
      Read FSA header and version from a stream, consuming read bytes.
      static void write​(java.io.OutputStream os, byte version)
      Writes FSA magic bytes and version information.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MAX_HEADER_LENGTH

        static final int MAX_HEADER_LENGTH
        Maximum length of the header block.
        See Also:
        Constant Field Values
      • version

        final byte version
        FSA version number.
    • Constructor Detail

      • FSAHeader

        FSAHeader​(byte version)
    • Method Detail

      • read

        public static FSAHeader read​(java.io.InputStream in)
                              throws java.io.IOException
        Read FSA header and version from a stream, consuming read bytes.
        Parameters:
        in - The input stream to read data from.
        Returns:
        Returns a valid FSAHeader with version information.
        Throws:
        java.io.IOException - If the stream ends prematurely or if it contains invalid data.
      • write

        public static void write​(java.io.OutputStream os,
                                 byte version)
                          throws java.io.IOException
        Writes FSA magic bytes and version information.
        Parameters:
        os - The stream to write to.
        version - Automaton version.
        Throws:
        java.io.IOException - Rethrown if writing fails.