Package deepboof.io.torch7
Class ParseTorch7
java.lang.Object
deepboof.io.torch7.ParseTorch7
- Direct Known Subclasses:
ParseAsciiTorch7,ParseBinaryTorch7
public abstract class ParseTorch7
extends java.lang.Object
Parser for binary Torch 7 serialized objects.
Torch source code:- torch7/File.lua
-
Field Summary
Fields Modifier and Type Field Description protected java.io.DataInputinputprotected java.util.Map<java.lang.Integer,TorchReferenceable>masterTableprotected java.io.FileInputStreamstreamprotected booleanverbose -
Constructor Summary
Constructors Constructor Description ParseTorch7() -
Method Summary
Modifier and Type Method Description booleanisVerbose()java.util.List<TorchObject>parse(java.io.File file)Parses serialized objects inside the specified file.<T> TparseIntoBoof(java.io.File file)Parses the file, grabs the first element, and converts it into a Deep Boof object.<T extends TorchObject>
TparseOne(java.io.File file)abstract voidreadArrayByte(int size, byte[] storage)abstract voidreadArrayChar(int size, char[] storage)abstract voidreadArrayDouble(int size, double[] storage)abstract voidreadArrayFloat(int size, float[] storage)abstract voidreadArrayLong(int size, long[] storage)abstract booleanreadBoolean()abstract doublereadDouble()abstract floatreadFloat()abstract intreadS32()abstract longreadS64()abstract int[]readShape(int dimension)abstract java.lang.StringreadString()abstract TorchTypereadType()abstract intreadU8()ParseTorch7setVerbose(boolean verbose)intstringToVersionNumber(java.lang.String line)
-
Field Details
-
stream
protected java.io.FileInputStream stream -
input
protected java.io.DataInput input -
masterTable
-
verbose
protected boolean verbose
-
-
Constructor Details
-
ParseTorch7
public ParseTorch7()
-
-
Method Details
-
parseOne
- Throws:
java.io.IOException
-
parseIntoBoof
public <T> T parseIntoBoof(java.io.File file) throws java.io.IOExceptionParses the file, grabs the first element, and converts it into a Deep Boof object.- Throws:
java.io.IOException
-
parse
Parses serialized objects inside the specified file. A list of the top level objects is returned- Parameters:
file- Input file- Returns:
- List of
TorchObject - Throws:
java.io.IOException
-
stringToVersionNumber
public int stringToVersionNumber(java.lang.String line) -
readShape
public abstract int[] readShape(int dimension) throws java.io.IOException- Throws:
java.io.IOException
-
readType
- Throws:
java.io.IOException
-
readBoolean
public abstract boolean readBoolean() throws java.io.IOException- Throws:
java.io.IOException
-
readDouble
public abstract double readDouble() throws java.io.IOException- Throws:
java.io.IOException
-
readFloat
public abstract float readFloat() throws java.io.IOException- Throws:
java.io.IOException
-
readString
public abstract java.lang.String readString() throws java.io.IOException- Throws:
java.io.IOException
-
readS64
public abstract long readS64() throws java.io.IOException- Throws:
java.io.IOException
-
readS32
public abstract int readS32() throws java.io.IOException- Throws:
java.io.IOException
-
readU8
public abstract int readU8() throws java.io.IOException- Throws:
java.io.IOException
-
readArrayDouble
public abstract void readArrayDouble(int size, double[] storage) throws java.io.IOException- Throws:
java.io.IOException
-
readArrayFloat
public abstract void readArrayFloat(int size, float[] storage) throws java.io.IOException- Throws:
java.io.IOException
-
readArrayChar
public abstract void readArrayChar(int size, char[] storage) throws java.io.IOException- Throws:
java.io.IOException
-
readArrayByte
public abstract void readArrayByte(int size, byte[] storage) throws java.io.IOException- Throws:
java.io.IOException
-
readArrayLong
public abstract void readArrayLong(int size, long[] storage) throws java.io.IOException- Throws:
java.io.IOException
-
isVerbose
public boolean isVerbose() -
setVerbose
-