Package libai.io

Class MatrixIO


  • public class MatrixIO
    extends java.lang.Object
    This class implements basic IO functions for Matrix objects.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  MatrixIO.Target
      Serialization target
    • Constructor Summary

      Constructors 
      Constructor Description
      MatrixIO()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void write​(java.io.OutputStream output, java.util.Map<java.lang.String,Matrix> m)  
      static void write​(java.io.OutputStream output, java.util.Map<java.lang.String,Matrix> m, MatrixIO.Target t)
      Writes a set of Matrix objects to a given OutputStream.

      Note: When saving to MatrixIO.Target.CSV and MatrixIO.Target.TSV, a line separator \n will be inserted between matrices Note 2: Since Java doesn't support deserializing multiple objects from the same OutputStream if target is MatrixIO.Target.SERIAL then the whole Map will be serialized.
      static void write​(java.io.OutputStream output, Matrix m)  
      static void write​(java.io.OutputStream output, Matrix m, MatrixIO.Target t)
      Writes a Matrix object to a given OutputStream.

      Note: if the target is MatrixIO.Target.OCTAVE then the default variable name will be 'a'.
      • Methods inherited from class java.lang.Object

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

      • MatrixIO

        public MatrixIO()
    • Method Detail

      • write

        public static void write​(java.io.OutputStream output,
                                 Matrix m)
                          throws java.lang.IllegalArgumentException,
                                 java.io.IOException
        Throws:
        java.lang.IllegalArgumentException
        java.io.IOException
      • write

        public static void write​(java.io.OutputStream output,
                                 Matrix m,
                                 MatrixIO.Target t)
                          throws java.lang.IllegalArgumentException,
                                 java.io.IOException
        Writes a Matrix object to a given OutputStream.

        Note: if the target is MatrixIO.Target.OCTAVE then the default variable name will be 'a'.
        Parameters:
        output - The OutputStream in which to save this Matrix object
        m - The Matrix object to write
        t - MatrixIO.Targeted format, the default value (if null) is MatrixIO.Target.SERIAL
        Throws:
        java.lang.IllegalArgumentException - if either output or m are null
        java.io.IOException - if an I/O error occurs
      • write

        public static void write​(java.io.OutputStream output,
                                 java.util.Map<java.lang.String,Matrix> m)
                          throws java.lang.IllegalArgumentException,
                                 java.io.IOException
        Throws:
        java.lang.IllegalArgumentException
        java.io.IOException
      • write

        public static void write​(java.io.OutputStream output,
                                 java.util.Map<java.lang.String,Matrix> m,
                                 MatrixIO.Target t)
                          throws java.lang.IllegalArgumentException,
                                 java.io.IOException
        Writes a set of Matrix objects to a given OutputStream.

        Note: When saving to MatrixIO.Target.CSV and MatrixIO.Target.TSV, a line separator \n will be inserted between matrices Note 2: Since Java doesn't support deserializing multiple objects from the same OutputStream if target is MatrixIO.Target.SERIAL then the whole Map will be serialized.
        Parameters:
        output - The OutputStream in which to write the Matrix objects
        m - a Map where the keys are matrix names, if the target is anything but MatrixIO.Target.OCTAVE the name will be ignored
        t - MatrixIO.Targeted format, the default value (if null) is MatrixIO.Target.SERIAL
        Throws:
        java.lang.IllegalArgumentException - if either output or m are null
        java.io.IOException - if an I/O error occurs