com.instantbank.common.uiutils
Class ByteArrayFromFile

java.lang.Object
  |
  +--com.instantbank.common.uiutils.ByteArrayFromFile

public class ByteArrayFromFile
extends java.lang.Object

Extracts content of a file as an array of bytes.

Author:
InstantBank (Rodrigo Lopez)

Field Summary
private  byte[] buff
          Bytes buffer where the read operation puts read bytes.
(package private) static int BUFSIZE
          Buffer size for bytes reading from the file.
private  java.io.ByteArrayOutputStream outbyte
          Output Stream where read bytes are appended.
 
Constructor Summary
ByteArrayFromFile(java.io.File file)
          Constructor for the ByteArrayFromFile object.
ByteArrayFromFile(java.lang.String file)
          Constructor for the ByteArrayFromFile object.
 
Method Summary
 byte[] getBytes()
          Returns the content of the file as an array of bytes.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

BUFSIZE

static final int BUFSIZE
Buffer size for bytes reading from the file.

buff

private byte[] buff
Bytes buffer where the read operation puts read bytes.

outbyte

private java.io.ByteArrayOutputStream outbyte
Output Stream where read bytes are appended.
Constructor Detail

ByteArrayFromFile

public ByteArrayFromFile(java.lang.String file)
                  throws java.io.IOException
Constructor for the ByteArrayFromFile object.
Parameters:
file - Name of the file whose bytes are to be delivered.
Throws:
java.io.IOException -  

ByteArrayFromFile

public ByteArrayFromFile(java.io.File file)
                  throws java.io.IOException
Constructor for the ByteArrayFromFile object.
Parameters:
file - File object whose bytes are to be delivered.
Throws:
java.io.IOException -  
Method Detail

getBytes

public byte[] getBytes()
Returns the content of the file as an array of bytes.
Returns:
The bytes value