hep.io.xdr
Class XDRBufferedRandomAccessFile

java.lang.Object
  extended by java.io.RandomAccessFile
      extended by hep.io.xdr.XDRRandomAccessFile
          extended by hep.io.xdr.XDRBufferedRandomAccessFile
All Implemented Interfaces:
XDRDataInput, XDRDataOutput, Closeable, DataInput, DataOutput, Flushable

public class XDRBufferedRandomAccessFile
extends XDRRandomAccessFile

The performance of XDRRandomAccessFile used directly is pretty appalling. This is a buffered implementation that is much faster so long as it is used mostly for reading or mostly for writing.


Constructor Summary
XDRBufferedRandomAccessFile(File file, boolean readOnly, int bufferSize)
           
XDRBufferedRandomAccessFile(String name, boolean readOnly, int bufferSize)
           
 
Method Summary
 void close()
           
 void flush()
           
 long getFilePointer()
           
 int read()
           
 int read(byte[] buf)
           
 int read(byte[] buf, int start, int length)
           
 void seek(long position)
           
 void write(byte[] buf)
           
 void write(byte[] buf, int start, int len)
           
 void write(int b)
           
 
Methods inherited from class hep.io.xdr.XDRRandomAccessFile
pad, readDoubleArray, readFloatArray, readIntArray, readString, readString, writeDoubleArray, writeDoubleArray, writeFloatArray, writeFloatArray, writeIntArray, writeIntArray, writeString, writeStringChars
 
Methods inherited from class java.io.RandomAccessFile
getChannel, getFD, length, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, setLength, skipBytes, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.io.DataInput
readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, skipBytes
 
Methods inherited from interface java.io.DataOutput
writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
 

Constructor Detail

XDRBufferedRandomAccessFile

public XDRBufferedRandomAccessFile(String name,
                                   boolean readOnly,
                                   int bufferSize)
                            throws IOException
Throws:
IOException

XDRBufferedRandomAccessFile

public XDRBufferedRandomAccessFile(File file,
                                   boolean readOnly,
                                   int bufferSize)
                            throws IOException
Throws:
IOException
Method Detail

getFilePointer

public long getFilePointer()
                    throws IOException
Overrides:
getFilePointer in class RandomAccessFile
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class RandomAccessFile
Throws:
IOException

flush

public void flush()
           throws IOException
Specified by:
flush in interface Flushable
Overrides:
flush in class XDRRandomAccessFile
Throws:
IOException

read

public int read()
         throws IOException
Overrides:
read in class RandomAccessFile
Throws:
IOException

read

public int read(byte[] buf)
         throws IOException
Overrides:
read in class RandomAccessFile
Throws:
IOException

read

public int read(byte[] buf,
                int start,
                int length)
         throws IOException
Overrides:
read in class RandomAccessFile
Throws:
IOException

seek

public void seek(long position)
          throws IOException
Overrides:
seek in class RandomAccessFile
Throws:
IOException

write

public void write(byte[] buf,
                  int start,
                  int len)
           throws IOException
Specified by:
write in interface DataOutput
Overrides:
write in class RandomAccessFile
Throws:
IOException

write

public void write(byte[] buf)
           throws IOException
Specified by:
write in interface DataOutput
Overrides:
write in class RandomAccessFile
Throws:
IOException

write

public void write(int b)
           throws IOException
Specified by:
write in interface DataOutput
Overrides:
write in class RandomAccessFile
Throws:
IOException


Copyright © 2000-2013 FreeHEP. All Rights Reserved.