Class ModelReader

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class ModelReader
    extends java.lang.Object
    implements java.io.Closeable
    Reads the Xgboost model from stream.
    • Field Detail

      • stream

        private final java.io.InputStream stream
      • buffer

        private byte[] buffer
    • Constructor Detail

      • ModelReader

        @Deprecated
        public ModelReader​(java.lang.String filename)
                    throws java.io.IOException
        Deprecated.
        Throws:
        java.io.IOException
      • ModelReader

        public ModelReader​(java.io.InputStream in)
                    throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • fillBuffer

        private int fillBuffer​(int numBytes)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • readByteAsInt

        public int readByteAsInt()
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • readByteArray

        public byte[] readByteArray​(int numBytes)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • readInt

        public int readInt()
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • readIntBE

        public int readIntBE()
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • readInt

        private int readInt​(java.nio.ByteOrder byteOrder)
                     throws java.io.IOException
        Throws:
        java.io.IOException
      • readIntArray

        public int[] readIntArray​(int numValues)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • readUnsignedInt

        public int readUnsignedInt()
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • readLong

        public long readLong()
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • asFloat

        public float asFloat​(byte[] bytes)
      • asUnsignedInt

        public int asUnsignedInt​(byte[] bytes)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • readFloat

        public float readFloat()
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • readFloatArray

        public float[] readFloatArray​(int numValues)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • readDoubleArrayBE

        public double[] readDoubleArrayBE​(int numValues)
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • skip

        public void skip​(long numBytes)
                  throws java.io.IOException
        Throws:
        java.io.IOException
      • readString

        public java.lang.String readString()
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • readString

        public java.lang.String readString​(int numBytes)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • readUTF

        public java.lang.String readUTF()
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • readUTF

        public java.lang.String readUTF​(int utflen)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException