krati.io
Class ChannelWriter

java.lang.Object
  extended by krati.io.ChannelWriter
All Implemented Interfaces:
DataWriter

public class ChannelWriter
extends Object
implements DataWriter

A simple data writer based on FileChannel.

Author:
jwu

Constructor Summary
ChannelWriter(File file)
           
 
Method Summary
 void close()
           
 void flush()
           
 File getFile()
           
 void open()
           
 long position()
           
 void position(long newPosition)
           
 void writeBytes(byte[] bytes)
           
 void writeBytes(long position, byte[] bytes)
           
 void writeInt(int value)
           
 void writeInt(long position, int value)
           
 void writeLong(long value)
           
 void writeLong(long position, long value)
           
 void writeShort(long position, short value)
           
 void writeShort(short value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChannelWriter

public ChannelWriter(File file)
Method Detail

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(int value)
              throws IOException
Specified by:
writeInt in interface DataWriter
Throws:
IOException

writeLong

public void writeLong(long value)
               throws IOException
Specified by:
writeLong in interface DataWriter
Throws:
IOException

writeShort

public void writeShort(short value)
                throws IOException
Specified by:
writeShort in interface DataWriter
Throws:
IOException

writeBytes

public void writeBytes(byte[] bytes)
                throws IOException
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

writeBytes

public void writeBytes(long position,
                       byte[] bytes)
                throws IOException
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.