Class FileIO


  • class FileIO
    extends java.lang.Object
    Functionality to read and write MemoryStore to/from a file.
    • Field Detail

      • MAGIC_NUMBER

        private static final byte[] MAGIC_NUMBER
        Magic number for Binary Memory Store Files
      • BMSF_VERSION

        private static final int BMSF_VERSION
        The version number of the current format.
        See Also:
        Constant Field Values
      • DATATYPE_LITERAL_MARKER

        public static final int DATATYPE_LITERAL_MARKER
        See Also:
        Constant Field Values
      • charsetEncoder

        private final java.nio.charset.CharsetEncoder charsetEncoder
      • charsetDecoder

        private final java.nio.charset.CharsetDecoder charsetDecoder
      • formatVersion

        private int formatVersion
    • Method Detail

      • writeNamespaces

        private void writeNamespaces​(SailDataset store,
                                     java.io.DataOutputStream dataOut)
                              throws java.io.IOException,
                                     SailException
        Throws:
        java.io.IOException
        SailException
      • readNamespace

        private void readNamespace​(java.io.DataInputStream dataIn,
                                   SailSink store)
                            throws java.io.IOException,
                                   SailException
        Throws:
        java.io.IOException
        SailException
      • readStatement

        private void readStatement​(boolean hasContext,
                                   boolean isExplicit,
                                   java.io.DataInputStream dataIn,
                                   SailSink explicit,
                                   SailSink inferred)
                            throws java.io.IOException,
                                   java.lang.ClassCastException,
                                   SailException
        Throws:
        java.io.IOException
        java.lang.ClassCastException
        SailException
      • writeValue

        private void writeValue​(Value value,
                                java.io.DataOutputStream dataOut)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • readValue

        private Value readValue​(java.io.DataInputStream dataIn)
                         throws java.io.IOException,
                                java.lang.ClassCastException
        Throws:
        java.io.IOException
        java.lang.ClassCastException
      • writeString

        private void writeString​(java.lang.String s,
                                 java.io.DataOutputStream dataOut)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • readString

        private java.lang.String readString​(java.io.DataInputStream dataIn)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • readStringV1

        private java.lang.String readStringV1​(java.io.DataInputStream dataIn)
                                       throws java.io.IOException
        Reads a string from the version 1 format, i.e. in Java's {@link DataInput#modified-utf-8 Modified UTF-8}.
        Throws:
        java.io.IOException
      • readStringV2

        private java.lang.String readStringV2​(java.io.DataInputStream dataIn)
                                       throws java.io.IOException
        Reads a string from the version 2 format. Strings are encoded as UTF-8 and are preceeded by a 32-bit integer (high byte first) specifying the length of the encoded string.
        Throws:
        java.io.IOException