Package biz.k11i.xgboost.util
Class ModelReader
- java.lang.Object
-
- biz.k11i.xgboost.util.ModelReader
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class ModelReader extends java.lang.Object implements java.io.CloseableReads the Xgboost model from stream.
-
-
Constructor Summary
Constructors Constructor Description ModelReader(java.io.InputStream in)ModelReader(java.lang.String filename)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description floatasFloat(byte[] bytes)intasUnsignedInt(byte[] bytes)voidclose()private intfillBuffer(int numBytes)byte[]readByteArray(int numBytes)intreadByteAsInt()double[]readDoubleArrayBE(int numValues)floatreadFloat()float[]readFloatArray(int numValues)intreadInt()private intreadInt(java.nio.ByteOrder byteOrder)int[]readIntArray(int numValues)intreadIntBE()longreadLong()java.lang.StringreadString()java.lang.StringreadString(int numBytes)intreadUnsignedInt()java.lang.StringreadUTF()java.lang.StringreadUTF(int utflen)voidskip(long numBytes)
-
-
-
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:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
-