krati.io
Class FastDataWriter
java.lang.Object
krati.io.FastDataWriter
- All Implemented Interfaces:
- DataWriter
public class FastDataWriter
- extends Object
- implements DataWriter
FastDataWriter: a simple writable channel, which is NOT thread safe.
Partially taken from org.xeril.util.io.FastDataWriteChannel.
- Author:
- jwu
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_BUFFER_SIZE
public static final int DEFAULT_BUFFER_SIZE
- See Also:
- Constant Field Values
FastDataWriter
public FastDataWriter(File file)
- Constructor
FastDataWriter
public FastDataWriter(File file,
int bufferSize)
- Constructor
write
public void write(int b)
throws IOException
- Parameters:
b
- the byte to be written.
- Throws:
IOException
- if an I/O error occurs.- See Also:
DataOutput.write(int)
write
public void write(byte[] b)
throws IOException
- Parameters:
b
- the data.
- Throws:
IOException
- if an I/O error occurs.- See Also:
DataOutput.write(byte[])
write
public void write(byte[] b,
int off,
int len)
throws IOException
- Parameters:
b
- the data.off
- the start offset in the data.len
- the number of bytes to write.
- Throws:
IOException
- if an I/O error occurs.- See Also:
DataOutput.write(byte[], int, int)
writeByte
public void writeByte(int v)
throws IOException
- Parameters:
v
- the byte value to be written.
- Throws:
IOException
- if an I/O error occurs.- See Also:
DataOutput.writeByte(int)
writeInt
public void writeInt(int v)
throws IOException
- Specified by:
writeInt
in interface DataWriter
- Parameters:
v
- the int
value to be written.
- Throws:
IOException
- if an I/O error occurs.- See Also:
DataOutput.writeInt(int)
writeShort
public void writeShort(short v)
throws IOException
- Specified by:
writeShort
in interface DataWriter
- Parameters:
v
- the short
value to be written.
- Throws:
IOException
- if an I/O error occurs.- See Also:
DataOutput.writeShort(int)
writeLong
public void writeLong(long v)
throws IOException
- Specified by:
writeLong
in interface DataWriter
- Parameters:
v
- the long
value to be written.
- Throws:
IOException
- if an I/O error occurs.- See Also:
DataOutput.writeLong(long)
writeFloat
public void writeFloat(float v)
throws IOException
- Parameters:
v
- the float
value to be written.
- Throws:
IOException
- if an I/O error occurs.- See Also:
DataOutput.writeFloat(float)
writeDouble
public void writeDouble(double v)
throws IOException
- Parameters:
v
- the double
value to be written.
- Throws:
IOException
- if an I/O error occurs.- See Also:
DataOutput.writeDouble(double)
writeBoolean
public void writeBoolean(boolean v)
throws IOException
- Parameters:
v
- the boolean to be written.
- Throws:
IOException
- if an I/O error occurs.- See Also:
DataOutput.writeBoolean(boolean)
getFile
public File getFile()
- Specified by:
getFile
in interface DataWriter
open
public void open()
throws IOException
- Specified by:
open
in interface DataWriter
- Throws:
IOException
close
public void close()
throws IOException
- Specified by:
close
in interface DataWriter
- Throws:
IOException
flush
public void flush()
throws IOException
- Specified by:
flush
in interface DataWriter
- Throws:
IOException
writeInt
public void writeInt(long position,
int value)
throws IOException
- Specified by:
writeInt
in interface DataWriter
- Throws:
IOException
writeLong
public void writeLong(long position,
long value)
throws IOException
- Specified by:
writeLong
in interface DataWriter
- Throws:
IOException
writeShort
public void writeShort(long position,
short value)
throws IOException
- Specified by:
writeShort
in interface DataWriter
- Throws:
IOException
position
public long position()
throws IOException
- Specified by:
position
in interface DataWriter
- Throws:
IOException
position
public void position(long newPosition)
throws IOException
- Specified by:
position
in interface DataWriter
- Throws:
IOException
Copyright © 2011. All Rights Reserved.