jhplot.io
Class HFile

java.lang.Object
  extended by jhplot.io.HFile

public class HFile
extends java.lang.Object

Write or read objects in sequential order using java serialization


Field Summary
 java.io.FileOutputStream oof
           
 java.io.ObjectOutputStream oos
           
 java.io.File recordsFile
           
 
Constructor Summary
HFile(java.lang.String file)
          Open file for reading objects from a serialized file in sequential order.
HFile(java.lang.String file, java.lang.String option)
          Open a file to write/read objects to/from a serialized file in sequential order.
 
Method Summary
 boolean close()
          Close the file
 int getEntries()
          Return processed number of entries
 java.lang.Object read()
          Get object from a file.
 void setFlush(int reset)
          Set after how many events data will be flushed.
 boolean write(java.lang.Object ob)
          Add an object to a file
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

recordsFile

public java.io.File recordsFile

oof

public java.io.FileOutputStream oof

oos

public java.io.ObjectOutputStream oos
Constructor Detail

HFile

public HFile(java.lang.String file,
             java.lang.String option)
Open a file to write/read objects to/from a serialized file in sequential order. If "w" option is set, the old file will be removed.

Parameters:
file - File name
option - Option to create the file . If "w" - write a file (or read) file, if "r" only read created file.

HFile

public HFile(java.lang.String file)
Open file for reading objects from a serialized file in sequential order.

Parameters:
file - File name
Method Detail

write

public boolean write(java.lang.Object ob)
Add an object to a file

Parameters:
ob - Object
key - key for object
Returns:
true if success

setFlush

public void setFlush(int reset)
Set after how many events data will be flushed. The stream will flush all the objects from the identity hash table. The default is 100.

Parameters:
reset - after how many events data will be reset.

getEntries

public int getEntries()
Return processed number of entries

Returns:
No of processed events

read

public java.lang.Object read()
Get object from a file. Return Null if the end if file is reached.

Returns:
Object extracted object (or Null)

close

public boolean close()
Close the file

Returns:


jHepWork 1.7 (C) Chekanov