|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbcds.tools.DataFileReader
bcds.phison.io.TrafficReader
public class TrafficReader
Reads a "traffic" file (usually, .trf), that is, the file that lists the
events (connection requests, connection release, time marks,
and other failure events).
A traffic file is a text file (which can be GZIP-compressed)
where each line describes an event.
See SimEvents
for a list of the possible events.
Comments start with the character '#' and run until the end of the line. A line containing the word "end" as its sole value is considered the logical end-of-file marker.
File format: The format of a traffic file is dependant on
the traffic generator. See gentraf
for more details on format.
Constructor Summary | |
---|---|
TrafficReader(java.io.Reader ips)
|
|
TrafficReader(java.lang.String fname)
Creates a reader for the file fname . |
Method Summary | |
---|---|
int |
getCap()
Returns the requested capacity when the type is SimEvents.CONN_REQUEST ; otherwise
returns -1. |
int |
getClock()
Returns the time of the event last read. |
java.lang.String |
getDemandType()
Returns the demand type of a connection request event, or nul if the event type is not {CONN_REQUEST}. |
int |
getDest()
Returns the destination of connection request when the type is SimEvents.CONN_REQUEST ; otherwise
returns -1. |
int |
getDuration()
Returns the requested connection duration when the type is SimEvents.CONN_REQUEST ; or the
duration of the failure for failure types. |
int |
getId()
Returns the connection id line last read. |
int |
getSrc()
Returns the source of connection request when the type is SimEvents.CONN_REQUEST ; otherwise
returns -1. |
SimEvents |
getType()
Returns the type of the line last read, or null at end-of-file. |
SimEvents |
next()
Reads one line of the traffic file and returns the traffic "type" (the same value returned by getType() . |
Methods inherited from class bcds.tools.DataFileReader |
---|
getFileName, getLineNum, getReader, newFileReader, nextLine, rewind |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TrafficReader(java.lang.String fname)
fname
.
java.io.IOException
- for any error detected by the
DataFileReader
constructor.public TrafficReader(java.io.Reader ips)
Method Detail |
---|
public SimEvents getType()
public int getId()
public int getSrc()
SimEvents.CONN_REQUEST
; otherwise
returns -1.
public int getDest()
SimEvents.CONN_REQUEST
; otherwise
returns -1.
public int getCap()
SimEvents.CONN_REQUEST
; otherwise
returns -1.
public int getDuration()
SimEvents.CONN_REQUEST
; or the
duration of the failure for failure types. Otherwise
returns -1.
public int getClock()
public java.lang.String getDemandType()
This is a user-defined value, and is not related to
getType()
. See DemandTypesReader
for more
information on demand types.
public SimEvents next()
getType()
.
After next() returns the getXXX() methods can be used to obtain
the items.
BadFormatException
- if the file is syntactically erroneous.
java.lang.NumberFormatException
- when a value for a numeric item
cannot be converted to integer.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |