jAER project on SourceForge

ch.unizh.ini.jaer.projects.opticalflow.io
Class MotionInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by java.io.DataInputStream
              extended by ch.unizh.ini.jaer.projects.opticalflow.io.MotionInputStream
All Implemented Interfaces:
java.io.Closeable, java.io.DataInput, InputDataFileInterface

public class MotionInputStream
extends java.io.DataInputStream
implements InputDataFileInterface

An input stream of motion data. This class deserializes MotionData from the input stream.

Author:
tobi

Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
MotionInputStream(java.io.FileInputStream is)
          Creates a new instance of MotionInputStream
 
Method Summary
 float getFractionalPosition()
           
 java.beans.PropertyChangeSupport getSupport()
           
 void mark()
          mark the current position.
 int position()
          return position in events
 void position(int n)
          set position in units of the file, e.g.
 MotionData readData()
          Reads and deserializes a MotionData object from the input stream
 void rewind()
          rewind to the start, or to the marked position, if it has been set
 void setFractionalPosition(float frac)
          Sets fractional position in units of the file
 void setSupport(java.beans.PropertyChangeSupport support)
           
 long size()
           
 void unmark()
          clear any marked position
 
Methods inherited from class java.io.DataInputStream
read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, readUTF, skipBytes
 
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MotionInputStream

public MotionInputStream(java.io.FileInputStream is)
                  throws java.io.IOException
Creates a new instance of MotionInputStream

Parameters:
is - the input stream
Throws:
java.io.IOException
Method Detail

readData

public MotionData readData()
                    throws java.io.IOException
Reads and deserializes a MotionData object from the input stream

Returns:
the data frame
Throws:
java.io.IOException

getFractionalPosition

public float getFractionalPosition()
Specified by:
getFractionalPosition in interface InputDataFileInterface
Returns:
fractional position in total events

mark

public void mark()
          throws java.io.IOException
Description copied from interface: InputDataFileInterface
mark the current position.

Specified by:
mark in interface InputDataFileInterface
Throws:
java.io.IOException - if there is some error in reading the data

position

public int position()
Description copied from interface: InputDataFileInterface
return position in events

Specified by:
position in interface InputDataFileInterface

position

public void position(int n)
Description copied from interface: InputDataFileInterface
set position in units of the file, e.g. events or frames

Specified by:
position in interface InputDataFileInterface
Parameters:
n - the number to position to

rewind

public void rewind()
            throws java.io.IOException
Description copied from interface: InputDataFileInterface
rewind to the start, or to the marked position, if it has been set

Specified by:
rewind in interface InputDataFileInterface
Throws:
java.io.IOException

setFractionalPosition

public void setFractionalPosition(float frac)
Description copied from interface: InputDataFileInterface
Sets fractional position in units of the file

Specified by:
setFractionalPosition in interface InputDataFileInterface
Parameters:
frac - 0-1 float range, 0 at start, 1 at end

size

public long size()
Specified by:
size in interface InputDataFileInterface
Returns:
size of data file in MotionData units

unmark

public void unmark()
Description copied from interface: InputDataFileInterface
clear any marked position

Specified by:
unmark in interface InputDataFileInterface

getSupport

public java.beans.PropertyChangeSupport getSupport()

setSupport

public void setSupport(java.beans.PropertyChangeSupport support)

jAER project on SourceForge