|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jouvieje.bass.misc.FileReaderUtils
This class allow you to read some datas from a RandomAccessFile
object.
Field Summary | |
static int |
SIZEOF_BYTE
Size of a byte in bytes !!! |
static int |
SIZEOF_CHAR
Size of a char in bytes |
static int |
SIZEOF_DOUBLE
Size of a double in bytes |
static int |
SIZEOF_FLOAT
Size of a float in bytes |
static int |
SIZEOF_INT
Size of an int in bytes |
static int |
SIZEOF_LONG
Size of a long in bytes |
static int |
SIZEOF_SHORT
Size of a short in bytes |
Constructor Summary | |
FileReaderUtils()
|
Method Summary | |
static byte |
readByte(java.io.RandomAccessFile file)
Read a simple byte into the file. |
static void |
readByteArray(java.io.RandomAccessFile file,
byte[] datas,
int offset,
int nbBytes)
Read a byte[] from a file. |
static byte[] |
readByteArray(java.io.RandomAccessFile file,
int nbBytes)
Read a byte[] from a file. |
static void |
readByteBuffer(java.io.RandomAccessFile file,
java.nio.ByteBuffer buffer,
int nbBytes)
Read a ByteBuffer from a file. |
static java.nio.ByteBuffer |
readByteBuffer(java.io.RandomAccessFile file,
int nbBytes)
Read a ByteBuffer from a file. |
static char |
readChar(java.io.RandomAccessFile file)
Read a char from 2 bytes of the file. |
static double |
readDouble(java.io.RandomAccessFile file)
Read a double from 8 bytes of the file. |
static float |
readFloat(java.io.RandomAccessFile file)
Read a float from 4 bytes of the file. |
static int |
readInt(java.io.RandomAccessFile file)
Read an int from 4 bytes of the file. |
static long |
readLong(java.io.RandomAccessFile file)
Read a long from 8 bytes of the file. |
static short |
readShort(java.io.RandomAccessFile file)
Read a short from 2 bytes of the file. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int SIZEOF_BYTE
public static final int SIZEOF_CHAR
public static final int SIZEOF_SHORT
public static final int SIZEOF_INT
public static final int SIZEOF_LONG
public static final int SIZEOF_FLOAT
public static final int SIZEOF_DOUBLE
Constructor Detail |
public FileReaderUtils()
Method Detail |
public static byte readByte(java.io.RandomAccessFile file) throws java.io.IOException
byte
into the file.
byte
read from the file
java.io.IOException
- if an I/O error occures.public static short readShort(java.io.RandomAccessFile file) throws java.io.IOException
short
from 2 bytes of the file.
short
read from the file.
java.io.IOException
- if an I/O error occures.public static char readChar(java.io.RandomAccessFile file) throws java.io.IOException
char
from 2 bytes of the file.
char
read from the file.
java.io.IOException
- if an I/O error occures.public static int readInt(java.io.RandomAccessFile file) throws java.io.IOException
int
from 4 bytes of the file.
int
read from the file.
java.io.IOException
- if an I/O error occures.public static float readFloat(java.io.RandomAccessFile file) throws java.io.IOException
float
from 4 bytes of the file.
float
read from the file.
java.io.IOException
- if an I/O error occures.public static long readLong(java.io.RandomAccessFile file) throws java.io.IOException
long
from 8 bytes of the file.
long
read from the file.
java.io.IOException
- if an I/O error occures.public static double readDouble(java.io.RandomAccessFile file) throws java.io.IOException
double
from 8 bytes of the file.
double
read from the file.
java.io.IOException
- if an I/O error occures.public static byte[] readByteArray(java.io.RandomAccessFile file, int nbBytes) throws java.io.IOException
byte[]
from a file.
nbBytes
- number of bytes to read.
byte[]
read from the file.
java.io.IOException
- if an I/O error occures.public static void readByteArray(java.io.RandomAccessFile file, byte[] datas, int offset, int nbBytes) throws java.io.IOException
byte[]
from a file.
datas
- byte[]
into which the data is read.offset
- offsetnbBytes
- number of bytes to be read.
java.io.IOException
- if an I/O error occures.public static java.nio.ByteBuffer readByteBuffer(java.io.RandomAccessFile file, int nbBytes) throws java.io.IOException
ByteBuffer
from a file.
nbBytes
- number of bytes to be read.
ByteBuffer
read from the file
java.io.IOException
- if an I/O error occures.public static void readByteBuffer(java.io.RandomAccessFile file, java.nio.ByteBuffer buffer, int nbBytes) throws java.io.IOException
ByteBuffer
from a file.
buffer
- ByteBuffer
into which the data is read.nbBytes
- number of bytes to be read.
java.io.IOException
- if an I/O error occures.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |