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.DataInput input  
    protected java.util.Map<java.lang.Integer,​TorchReferenceable> masterTable  
    protected java.io.FileInputStream stream  
    protected boolean verbose  
  • Constructor Summary

    Constructors 
    Constructor Description
    ParseTorch7()  
  • Method Summary

    Modifier and Type Method Description
    boolean isVerbose()  
    java.util.List<TorchObject> parse​(java.io.File file)
    Parses serialized objects inside the specified file.
    <T> T parseIntoBoof​(java.io.File file)
    Parses the file, grabs the first element, and converts it into a Deep Boof object.
    <T extends TorchObject>
    T
    parseOne​(java.io.File file)  
    abstract void readArrayByte​(int size, byte[] storage)  
    abstract void readArrayChar​(int size, char[] storage)  
    abstract void readArrayDouble​(int size, double[] storage)  
    abstract void readArrayFloat​(int size, float[] storage)  
    abstract void readArrayLong​(int size, long[] storage)  
    abstract boolean readBoolean()  
    abstract double readDouble()  
    abstract float readFloat()  
    abstract int readS32()  
    abstract long readS64()  
    abstract int[] readShape​(int dimension)  
    abstract java.lang.String readString()  
    abstract TorchType readType()  
    abstract int readU8()  
    ParseTorch7 setVerbose​(boolean verbose)  
    int stringToVersionNumber​(java.lang.String line)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • parseOne

      public <T extends TorchObject> T parseOne​(java.io.File file) throws java.io.IOException
      Throws:
      java.io.IOException
    • parseIntoBoof

      public <T> T parseIntoBoof​(java.io.File file) throws java.io.IOException
      Parses the file, grabs the first element, and converts it into a Deep Boof object.
      Throws:
      java.io.IOException
    • parse

      public java.util.List<TorchObject> parse​(java.io.File file) throws java.io.IOException
      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

      public abstract TorchType readType() throws java.io.IOException
      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

      public ParseTorch7 setVerbose​(boolean verbose)