marf.Storage
Class ByteArrayFileReader

java.lang.Object
  extended by marf.Storage.ByteArrayFileReader

public class ByteArrayFileReader
extends java.lang.Object

Reads in a file contents into a byte array buffers.

$Id: ByteArrayFileReader.java,v 1.5 2008/02/20 07:29:06 mokhov Exp $

Since:
0.3.0.6
Version:
$Revision: 1.5 $
Author:
Serguei Mokhov

Field Summary
protected  byte[][] attBuffers
          Buffer of buffers to fill in.
static int DEFAULT_BUFFER_SIZE
          Default size of each buffer in bytes.
static int DEFAULT_NUMBER_OF_BUFFERS
          Default number of reserved buffers.
protected  int iBufferCount
          Contained used buffers count.
protected  int iBufferSize
          Current buffer size.
protected  int iFileSize
          Contained file size in bytes.
 
Constructor Summary
ByteArrayFileReader()
          Constructs an empty reader.
ByteArrayFileReader(java.io.File poFile)
          Constructs the reader with the contents of the file by specifying the File object.
ByteArrayFileReader(java.io.InputStream poInputStream)
          Constructs the reader with the contents of the file by specifying the InputStream object.
ByteArrayFileReader(java.io.Reader poReader)
          Constructs the reader with the contents of the file by specifying the Reader object.
ByteArrayFileReader(java.lang.String pstrFilename)
          Constructs the reader with the contents of the file by specifying the filename.
ByteArrayFileReader(java.net.URI poURI)
          Constructs the reader with the contents of the file by specifying the URI.
 
Method Summary
 int getFileSize()
           
 byte[] read(java.io.File poFile)
           
 byte[] read(java.io.InputStream poInputStream)
           
 byte[] read(java.io.Reader poReader)
           
 byte[] read(java.net.URI poURI)
           
 byte[] toByteArray()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_NUMBER_OF_BUFFERS

public static final int DEFAULT_NUMBER_OF_BUFFERS
Default number of reserved buffers.

See Also:
Constant Field Values

DEFAULT_BUFFER_SIZE

public static final int DEFAULT_BUFFER_SIZE
Default size of each buffer in bytes.

See Also:
Constant Field Values

attBuffers

protected byte[][] attBuffers
Buffer of buffers to fill in.


iFileSize

protected int iFileSize
Contained file size in bytes.


iBufferCount

protected int iBufferCount
Contained used buffers count.


iBufferSize

protected int iBufferSize
Current buffer size.

Constructor Detail

ByteArrayFileReader

public ByteArrayFileReader()
Constructs an empty reader.


ByteArrayFileReader

public ByteArrayFileReader(java.lang.String pstrFilename)
                    throws java.io.FileNotFoundException,
                           java.io.IOException
Constructs the reader with the contents of the file by specifying the filename.

Parameters:
pstrFilename -
Throws:
java.io.FileNotFoundException
java.io.IOException

ByteArrayFileReader

public ByteArrayFileReader(java.io.File poFile)
                    throws java.io.FileNotFoundException,
                           java.io.IOException
Constructs the reader with the contents of the file by specifying the File object.

Parameters:
poFile -
Throws:
java.io.FileNotFoundException
java.io.IOException

ByteArrayFileReader

public ByteArrayFileReader(java.net.URI poURI)
Constructs the reader with the contents of the file by specifying the URI.

Parameters:
poURI -

ByteArrayFileReader

public ByteArrayFileReader(java.io.InputStream poInputStream)
                    throws java.io.IOException
Constructs the reader with the contents of the file by specifying the InputStream object.

Parameters:
poInputStream -
Throws:
java.io.IOException

ByteArrayFileReader

public ByteArrayFileReader(java.io.Reader poReader)
Constructs the reader with the contents of the file by specifying the Reader object.

Parameters:
poReader -
Method Detail

read

public byte[] read(java.io.File poFile)
            throws java.io.FileNotFoundException,
                   java.io.IOException
Parameters:
poFile -
Returns:
Throws:
java.io.FileNotFoundException
java.io.IOException

read

public byte[] read(java.net.URI poURI)
Parameters:
poURI - unused
Returns:
Throws:
NotImplementedException

read

public byte[] read(java.io.InputStream poInputStream)
            throws java.io.IOException
Parameters:
poInputStream -
Returns:
Throws:
java.io.IOException

read

public byte[] read(java.io.Reader poReader)
Parameters:
poReader -
Returns:
Throws:
NotImplementedException

toByteArray

public byte[] toByteArray()
Returns:

getFileSize

public int getFileSize()


SourceForge Logo