adaptj
Class AEFReader

java.lang.Object
  |
  +--adaptj.AEFReader
All Implemented Interfaces:
AdaptJSpecConstants, IAEFReader

public class AEFReader
extends java.lang.Object
implements AdaptJSpecConstants, IAEFReader

The AEFReader class verifies and parses an AdaptJ Event File (AEF). It first parses the entire file to check its format. At this point, the header information of the file is available. The AEFReader then repositions itself for reading the events from the file, one at a time.

Author:
Bruno Dufour

Field Summary
 
Fields inherited from interface adaptj.spec.AdaptJSpecConstants
ADAPTJ_COMPACT_INSTRUCTION_START, ADAPTJ_FIELD_ARENA_ID, ADAPTJ_FIELD_ARENA_NAME, ADAPTJ_FIELD_CHOSEN_PAIR_INDEX, ADAPTJ_FIELD_CLASS_LOAD_CLASS_ID, ADAPTJ_FIELD_CLASS_NAME, ADAPTJ_FIELD_CLASS_UNLOAD_CLASS_ID, ADAPTJ_FIELD_CODE, ADAPTJ_FIELD_CODE_SIZE, ADAPTJ_FIELD_COUNTED, ADAPTJ_FIELD_DATA, ADAPTJ_FIELD_DATA_LEN, ADAPTJ_FIELD_ENV_ID, ADAPTJ_FIELD_GROUP_NAME, ADAPTJ_FIELD_HI, ADAPTJ_FIELD_ID, ADAPTJ_FIELD_INSTANCES, ADAPTJ_FIELD_IS_ARRAY, ADAPTJ_FIELD_IS_TRUE, ADAPTJ_FIELD_KEY, ADAPTJ_FIELD_LINENO_TABLE, ADAPTJ_FIELD_LINENO_TABLE_SIZE, ADAPTJ_FIELD_LOW, ADAPTJ_FIELD_METHOD_ID, ADAPTJ_FIELD_METHODS, ADAPTJ_FIELD_NAME, ADAPTJ_FIELD_NEW_ARENA_ID, ADAPTJ_FIELD_NEW_OBJ_ID, ADAPTJ_FIELD_NEW_STATUS, ADAPTJ_FIELD_NUM_INSTANCE_FIELDS, ADAPTJ_FIELD_NUM_INTERFACES, ADAPTJ_FIELD_NUM_METHODS, ADAPTJ_FIELD_NUM_STATIC_FIELDS, ADAPTJ_FIELD_NUM_TRACES, ADAPTJ_FIELD_OBJ_ID, ADAPTJ_FIELD_OBJECT, ADAPTJ_FIELD_OBJECT_ALLOC_CLASS_ID, ADAPTJ_FIELD_OFFSET, ADAPTJ_FIELD_PAIRS_TOTAL, ADAPTJ_FIELD_PARENT_NAME, ADAPTJ_FIELD_RECORDED, ADAPTJ_FIELD_REF_ID, ADAPTJ_FIELD_SIZE, ADAPTJ_FIELD_SOURCE_NAME, ADAPTJ_FIELD_STATICS, ADAPTJ_FIELD_THREAD_ENV_ID, ADAPTJ_FIELD_THREAD_ID, ADAPTJ_FIELD_THREAD_NAME, ADAPTJ_FIELD_TIMEOUT, ADAPTJ_FIELD_TOTAL_OBJECT_SPACE, ADAPTJ_FIELD_TRACES, ADAPTJ_FIELD_USED_OBJECT_SPACE, ADAPTJ_FIELD_USED_OBJECTS, ADAPTJ_FILESPLIT, ADAPTJ_ISPIPED, ADAPTJ_MAGIC, ADAPTJ_SPEC_MAGIC, VERSION_MASK
 
Constructor Summary
AEFReader(java.io.File file)
           
AEFReader(java.io.File file, boolean pipedMode)
           
AEFReader(java.lang.String fileName)
          Constructs a new AEFReader which takes its input from fileName
AEFReader(java.lang.String fileName, boolean pipedMode)
           
 
Method Summary
 long getEventCount()
          Returns the total number of events found in this AdaptJ Event File.
 short[] getEventInfo()
           
 AdaptJEvent getNextEvent()
          Returns the next available AdaptJEvent in the AdaptJ Event File.
 long[] getRuntimeCounters()
           
 long[] getStaticCounters()
          Returns an array of counters for this AdaptJ Event File.
 int getVersion()
          Returns the version number of the AdaptJ Event File being read.
 boolean hasMoreEvents()
          Returns true if this AEFReader has more elements.
 boolean isPiped()
           
 void preparse()
           
 void rewind()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AEFReader

public AEFReader(java.lang.String fileName)
          throws java.io.IOException,
                 AEFFormatException
Constructs a new AEFReader which takes its input from fileName

Parameters:
fileName - The name of a file to read from. This file must exist and have the correct format of an AdaptJ Event File (see above).
Throws:
java.io.FileNotFoundException - if fileName does not exists
java.io.IOException - if an error occurs while reading fileName
AEFFormatException - if the format of fileName appears to be invalid

AEFReader

public AEFReader(java.lang.String fileName,
                 boolean pipedMode)
          throws java.io.IOException,
                 AEFFormatException

AEFReader

public AEFReader(java.io.File file)
          throws java.io.IOException,
                 AEFFormatException

AEFReader

public AEFReader(java.io.File file,
                 boolean pipedMode)
          throws java.io.IOException,
                 AEFFormatException
Method Detail

getVersion

public int getVersion()
Returns the version number of the AdaptJ Event File being read. This is a number between 0 and 255, 0 being reserved for testing versions of the AdaptJ framework.

Specified by:
getVersion in interface IAEFReader
Returns:
The version number of the AdaptJ Event File being read.

getStaticCounters

public long[] getStaticCounters()
Returns an array of counters for this AdaptJ Event File. The counters represent the number of times a particular event has occured. This information can be calculated by a JVMPI agent (or another source of profiling data) and incorporated into the AdaptJ Event File, or is calculated by this AEFReader when the event is recorded. When no information is available for a particular event is known, the counter value is less than 0.

Specified by:
getStaticCounters in interface IAEFReader
Returns:
an array of counters for all AdaptJ Event, indexed by the AdaptJ Event type constant.
See Also:
AdaptJEvent, #getDumpedTypes()

getRuntimeCounters

public long[] getRuntimeCounters()
Specified by:
getRuntimeCounters in interface IAEFReader

getEventInfo

public short[] getEventInfo()
Specified by:
getEventInfo in interface IAEFReader

rewind

public void rewind()
            throws java.io.IOException
java.io.IOException

preparse

public void preparse()
              throws AEFFormatException,
                     java.io.IOException
Specified by:
preparse in interface IAEFReader
AEFFormatException
java.io.IOException

getEventCount

public long getEventCount()
Returns the total number of events found in this AdaptJ Event File.

Specified by:
getEventCount in interface IAEFReader
Returns:
The total number of AdaptJEvent objects that are found in this AdaptJ Event File.

hasMoreEvents

public boolean hasMoreEvents()
Returns true if this AEFReader has more elements. (In other words, returns true if getNextEvent would return an event rather than throwing an exception.)

Specified by:
hasMoreEvents in interface IAEFReader
Returns:
true if this AEFReader has more elements; false otherwise.

isPiped

public boolean isPiped()
Specified by:
isPiped in interface IAEFReader

getNextEvent

public AdaptJEvent getNextEvent()
                         throws AEFFormatException,
                                java.io.IOException
Returns the next available AdaptJEvent in the AdaptJ Event File.

Specified by:
getNextEvent in interface IAEFReader
Returns:
The next available AdaptJEvent in the AdaptJ Event File.
Throws:
java.util.NoSuchElementException - if there are no more events to read
AEFFormatException
java.io.IOException