|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jouvieje.bass.misc.FileWriterUtils
This class allow you to write some datas into 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 | |
FileWriterUtils()
|
Method Summary | |
static void |
writeByte(java.io.RandomAccessFile file,
byte value)
Write a simple byte into the file. |
static void |
writeByteArray(java.io.RandomAccessFile file,
byte[] datas)
Write an entire byte[] into the file. |
static void |
writeByteArray(java.io.RandomAccessFile file,
byte[] datas,
int offset,
int length)
Write a part of a byte[] into the file. |
static int |
writeByteBuffer(java.io.RandomAccessFile file,
java.nio.ByteBuffer buffer)
Write an entire ByteBuffer into a file. |
static int |
writeByteBuffer(java.io.RandomAccessFile file,
java.nio.ByteBuffer buffer,
int length)
Write a part of a ByteBuffer into a file. |
static void |
writeChar(java.io.RandomAccessFile file,
char value)
Convert the char in 2 bytes and write them into the file. |
static void |
writeDouble(java.io.RandomAccessFile file,
double value)
Convert the double in 8 bytes and write them into the file. |
static void |
writeFloat(java.io.RandomAccessFile file,
float value)
Convert the float in 4 bytes and write them into the file. |
static void |
writeInt(java.io.RandomAccessFile file,
int value)
Convert the int in 4 bytes and write them into the file. |
static void |
writeLong(java.io.RandomAccessFile file,
long value)
Convert the long in 8 bytes and write them into the file. |
static void |
writeShort(java.io.RandomAccessFile file,
short value)
Convert the short |
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 FileWriterUtils()
Method Detail |
public static void writeByte(java.io.RandomAccessFile file, byte value) throws java.io.IOException
byte
into the file.
file
- a file to read in.value
- a byte
to be written into the file.
java.io.IOException
- if an I/O exception occures.public static void writeShort(java.io.RandomAccessFile file, short value) throws java.io.IOException
short in 2 bytes and write them into the file.
- Parameters:
file
- a file to read in.value
- a short to be written into the file.
- Throws:
java.io.IOException
- if an I/O exception occures.
public static void writeChar(java.io.RandomAccessFile file, char value) throws java.io.IOException
char
in 2 bytes and write them into the file.
file
- a file to read in.value
- a char
to be writte into the file.
java.io.IOException
- if an I/O exception occures.public static void writeInt(java.io.RandomAccessFile file, int value) throws java.io.IOException
int
in 4 bytes and write them into the file.
file
- a file to read in.value
- an int
to be written into the file.
java.io.IOException
- if an I/O exception occures.public static void writeFloat(java.io.RandomAccessFile file, float value) throws java.io.IOException
float
in 4 bytes and write them into the file.
file
- a file to read in.value
- a float
to be written into the file.
java.io.IOException
- if an I/O exception occures.public static void writeLong(java.io.RandomAccessFile file, long value) throws java.io.IOException
long
in 8 bytes and write them into the file.
file
- a file to read in.value
- a long
to be written into the file.
java.io.IOException
- if an I/O exception occures.public static void writeDouble(java.io.RandomAccessFile file, double value) throws java.io.IOException
double
in 8 bytes and write them into the file.
file
- a file to read in.value
- a double
to be written into the file.
java.io.IOException
- if an I/O exception occures.public static void writeByteArray(java.io.RandomAccessFile file, byte[] datas) throws java.io.IOException
byte[]
into the file.writeByteArray(file, datase, 0, datas.length)
file
- a file to read in.datas
- a byte[]
to be written into the file.
java.io.IOException
- if an I/O exception occures.public static void writeByteArray(java.io.RandomAccessFile file, byte[] datas, int offset, int length) throws java.io.IOException
byte[]
into the file.
file
- a file to read in.datas
- a byte[]
to write into the file.offset
- offset from the start of the byte[]
.length
- number of bytes to be written starting from the offset of the byte[]
.
java.io.IOException
- if an I/O exception occures.public static int writeByteBuffer(java.io.RandomAccessFile file, java.nio.ByteBuffer buffer) throws java.io.IOException
ByteBuffer
into a file.
file
- a file to read in.buffer
- a ByteBuffer
to be written into the file.
java.io.IOException
- if an I/O exception occures.public static int writeByteBuffer(java.io.RandomAccessFile file, java.nio.ByteBuffer buffer, int length) throws java.io.IOException
ByteBuffer
into a file.
file
- a file to read in.buffer
- a ByteBuffer
to be written into the file.length
- number of bytes to be written into the file.
java.io.IOException
- if an I/O exception occures.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |