|
jAER project on SourceForge | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
java.io.DataInputStream
ch.unizh.ini.jaer.projects.stereo3D.AE3DFileInputStream
public class AE3DFileInputStream
Class to stream in packets of events from binary input stream from a file recorded by 3D reconstructing filters.
File format is very simple: two adresses for left and right retina + timestamp
int32 x
int32 y
int32 z
float value
int32 timestamp
An optional header consisting of lines starting with '#' is skipped when opening the file and may be retrieved. No later comment lines are allowed because the rest ot the file must be pure binary data.
AE3DFileInputStream has PropertyChangeSupport via getSupport(). PropertyChangeListeners will get informed of the following events
Nested Class Summary | |
---|---|
class |
AE3DFileInputStream.NonMonotonicTimeException
class used to signal a backwards read from input stream |
class |
AE3DFileInputStream.WrappedTimeException
Indicates that timestamp has wrapped around from most positive to most negative signed value. |
Field Summary | |
---|---|
static int |
CHUNK_SIZE_BYTES
the size of the memory mapped part of the input file. |
static int |
EVENT_SIZE
|
protected java.util.ArrayList<java.lang.String> |
header
|
static int |
MAX_BUFFER_SIZE_EVENTS
|
int |
MAX_NONMONOTONIC_TIME_EXCEPTIONS_TO_PRINT
|
Constructor Summary | |
---|---|
AE3DFileInputStream(java.io.File f)
Creates a new instance of AEInputStream |
|
AE3DFileInputStream(java.io.FileInputStream in)
Deprecated. use the constructor with a File object so that users of this can more easily get file information |
Method Summary | |
---|---|
void |
close()
|
AEFileInputStream |
copy()
copies out the part of the stream from IN to OUT markers and returns it as a new AEInputStream |
AEFileInputStream |
cut()
cuts out the part of the stream from IN to OUT and returns it as a new AEInputStream |
long |
getAbsoluteStartingTimeMs()
When the file is opened, the filename is parsed to try to extract the date and time the file was created from the filename. |
int |
getCurrentStartTimestamp()
|
int |
getDurationUs()
|
java.io.File |
getFile()
Returns the File that is being read, or null if the instance is constructed from a FileInputStream |
int |
getFirstTimestamp()
returns the first timestamp in the stream |
float |
getFractionalPosition()
Returns the position as a fraction of the total number of events |
java.util.ArrayList<java.lang.String> |
getHeader()
Gets the header strings from the file |
int |
getLastTimestamp()
|
int |
getMostRecentTimestamp()
|
java.beans.PropertyChangeSupport |
getSupport()
AEFileInputStream has PropertyChangeSupport. |
void |
mark()
mark the current position. |
void |
markIn()
mark the current position as the IN point for editing. |
void |
markOut()
mark the current position as the OUT position for editing. |
void |
paste(AEFileInputStream in)
pastes the in stream at the IN marker into this stream |
int |
position()
gets the current position for reading forwards, i.e., readEventForwards will read this event number. |
void |
position(int event)
set position in events from start of file |
protected void |
readHeader()
reads the header comment lines. |
AEPacket3D |
readPacketByNumber(int n)
Uesd to read fixed size packets. |
AEPacket3D |
readPacketByTime(int dt)
returns an AEPacketRaw at least dt long up to the max size of the buffer or until end-of-file. |
void |
rewind()
rewind to the start, or to the marked position, if it has been set. |
void |
setAbsoluteStartingTimeMs(long absoluteStartingTimeMs)
|
void |
setCurrentStartTimestamp(int currentStartTimestamp)
|
void |
setFile(java.io.File f)
Sets the File reference but doesn't open the file |
void |
setFractionalPosition(float frac)
Sets fractional position in events |
void |
setMostRecentTimestamp(int mostRecentTimestamp)
|
long |
size()
gets the size of the stream in events |
protected void |
skipHeader()
skips the header lines (if any) |
java.lang.String |
toString()
|
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, mark, markSupported, read, reset, skip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public final int MAX_NONMONOTONIC_TIME_EXCEPTIONS_TO_PRINT
public static final int MAX_BUFFER_SIZE_EVENTS
public static final int EVENT_SIZE
public static final int CHUNK_SIZE_BYTES
protected java.util.ArrayList<java.lang.String> header
Constructor Detail |
---|
public AE3DFileInputStream(java.io.FileInputStream in)
public AE3DFileInputStream(java.io.File f) throws java.io.FileNotFoundException
f
- the file to open
java.io.FileNotFoundException
- if file doesn't exist or can't be readMethod Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
public AEPacket3D readPacketByNumber(int n) throws java.io.IOException
n
- the number of events to read
java.io.IOException
public AEPacket3D readPacketByTime(int dt) throws java.io.IOException
dt
- the timestamp different in units of the timestamp (usually us)
java.io.IOException
MAX_BUFFER_SIZE_EVENTS
public void rewind() throws java.io.IOException
java.io.IOException
public long size()
public void position(int event)
event
- the number of the event, starting with 0public int position()
public float getFractionalPosition()
public void setFractionalPosition(float frac)
frac
- 0-1 float range, 0 at start, 1 at endpublic java.beans.PropertyChangeSupport getSupport()
public void mark() throws java.io.IOException
java.io.IOException
- if there is some error in reading the datapublic void markIn() throws java.io.IOException
java.io.IOException
- if there is some error in reading the datapublic void markOut() throws java.io.IOException
java.io.IOException
- if there is some error in reading the datapublic void unmark()
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.FilterInputStream
java.io.IOException
public int getFirstTimestamp()
public int getLastTimestamp()
public int getDurationUs()
Assumes data file is timestamped in us. This method fails to provide a sensible value if the timestamp wwaps.
public int getCurrentStartTimestamp()
public void setCurrentStartTimestamp(int currentStartTimestamp)
public int getMostRecentTimestamp()
public void setMostRecentTimestamp(int mostRecentTimestamp)
public AEFileInputStream cut()
public AEFileInputStream copy()
public void paste(AEFileInputStream in)
in
- the stream to pasteprotected void skipHeader() throws java.io.IOException
java.io.IOException
protected void readHeader() throws java.io.IOException
java.io.IOException
public java.util.ArrayList<java.lang.String> getHeader()
public java.io.File getFile()
public void setFile(java.io.File f)
public long getAbsoluteStartingTimeMs()
public void setAbsoluteStartingTimeMs(long absoluteStartingTimeMs)
|
jAER project on SourceForge | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |