com.superhac.JXBStreamer.Core
Class FileHandlerObject

java.lang.Object
  extended by com.superhac.JXBStreamer.Core.FileHandlerObject

public class FileHandlerObject
extends java.lang.Object

The FileHandlerObject maps Files to handles and provides services for fulfilling client requests on Files. E.g. get file data.

More information can be found at Superhac.com


Constructor Summary
protected FileHandlerObject(int handle, java.io.File file)
           
 
Method Summary
protected  java.io.File getFile()
          Gets the File object of the file represented by FileHandleObject
protected  java.lang.String getFileName()
          Get the file name represented by FileHandleObject
protected  long getFileTransferRate()
          Gets the file transfer rate in seconds.
protected  int getHandle()
          Gets the handle number
protected  java.nio.ByteBuffer read(int numberOfBytes)
          Read a number of bytes from file
protected  boolean seekFile(long offset, byte seekType)
          Seek to a location withing the file...
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileHandlerObject

protected FileHandlerObject(int handle,
                            java.io.File file)
Method Detail

read

protected java.nio.ByteBuffer read(int numberOfBytes)
Read a number of bytes from file

Parameters:
numberOfBytes - the number of bytes to read
Returns:
A bytebuffer containing the read bytes.

seekFile

protected boolean seekFile(long offset,
                           byte seekType)
Seek to a location withing the file...

Parameters:
offset - an amount to seek from the SeekType
seekType - (0 = forward from the beginning of the file, 1 = backward from the end of the file, 2 = forward from the current position, 3 = backwards from the current position)
Returns:
True if its a success or false if not.

getFileName

protected java.lang.String getFileName()
Get the file name represented by FileHandleObject

Returns:
filename

getFile

protected java.io.File getFile()
Gets the File object of the file represented by FileHandleObject

Returns:
the File object

getHandle

protected int getHandle()
Gets the handle number

Returns:
handle number

getFileTransferRate

protected long getFileTransferRate()
Gets the file transfer rate in seconds. Based on the creation time of the object , the current system time and the number of bytes transfered. E.g. reads.

Returns:
The number of bytes per second transfered.