com.metsci.glimpse.util.io.datapipe
Class WritableDataChannel

java.lang.Object
  extended by com.metsci.glimpse.util.io.datapipe.AbstractChannel
      extended by com.metsci.glimpse.util.io.datapipe.WritableDataChannel
All Implemented Interfaces:
WritableDataPipe

public class WritableDataChannel
extends AbstractChannel
implements WritableDataPipe

An implementation of WritableDataPipe that uses nio.

Author:
hogye

Constructor Summary
WritableDataChannel(java.nio.channels.WritableByteChannel channel)
           
 
Method Summary
 void close()
           
 void flush()
           
 int flushBuffer()
           
 java.io.DataOutputStream getOutputStream()
           
 long getTotalBytesWritten()
           
 void writeArray(java.lang.Object array, int arrayLength, com.metsci.glimpse.util.io.datapipe.AbstractChannel.BufferWrapper buffer)
           
 void writeBoolean(boolean value)
           
 void writeBooleanArray(boolean[] values)
           
 void writeByte(byte value)
           
 void writeByteArray(byte[] values)
           
 void writeDouble(double value)
           
 void writeDoubleArray(double[] values)
           
 void writeFloat(float value)
           
 void writeFloatArray(float[] values)
           
 void writeInt(int value)
           
 void writeIntArray(int[] values)
           
 void writeLong(long value)
           
 void writeLongArray(long[] values)
           
 void writeShort(short value)
           
 void writeShortArray(short[] values)
           
 void writeString(java.lang.String value)
          Writes a string encoded in true UTF-8 format (not Java's modified UTF).
 
Methods inherited from class com.metsci.glimpse.util.io.datapipe.AbstractChannel
getChannel
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WritableDataChannel

public WritableDataChannel(java.nio.channels.WritableByteChannel channel)
                    throws java.io.IOException
Throws:
java.io.IOException
Method Detail

getTotalBytesWritten

public long getTotalBytesWritten()
Returns:
the total number of bytes written since this channel was created.

flushBuffer

public int flushBuffer()
                throws java.io.IOException
Returns:
the number of bytes written to the channel.
Throws:
java.io.IOException

writeBoolean

public void writeBoolean(boolean value)
                  throws java.io.IOException
Specified by:
writeBoolean in interface WritableDataPipe
Throws:
java.io.IOException

writeByte

public void writeByte(byte value)
               throws java.io.IOException
Specified by:
writeByte in interface WritableDataPipe
Throws:
java.io.IOException

writeShort

public void writeShort(short value)
                throws java.io.IOException
Specified by:
writeShort in interface WritableDataPipe
Throws:
java.io.IOException

writeInt

public void writeInt(int value)
              throws java.io.IOException
Specified by:
writeInt in interface WritableDataPipe
Throws:
java.io.IOException

writeLong

public void writeLong(long value)
               throws java.io.IOException
Specified by:
writeLong in interface WritableDataPipe
Throws:
java.io.IOException

writeFloat

public void writeFloat(float value)
                throws java.io.IOException
Specified by:
writeFloat in interface WritableDataPipe
Throws:
java.io.IOException

writeDouble

public void writeDouble(double value)
                 throws java.io.IOException
Specified by:
writeDouble in interface WritableDataPipe
Throws:
java.io.IOException

writeBooleanArray

public void writeBooleanArray(boolean[] values)
                       throws java.io.IOException
Specified by:
writeBooleanArray in interface WritableDataPipe
Throws:
java.io.IOException

writeByteArray

public void writeByteArray(byte[] values)
                    throws java.io.IOException
Specified by:
writeByteArray in interface WritableDataPipe
Throws:
java.io.IOException

writeShortArray

public void writeShortArray(short[] values)
                     throws java.io.IOException
Specified by:
writeShortArray in interface WritableDataPipe
Throws:
java.io.IOException

writeIntArray

public void writeIntArray(int[] values)
                   throws java.io.IOException
Specified by:
writeIntArray in interface WritableDataPipe
Throws:
java.io.IOException

writeLongArray

public void writeLongArray(long[] values)
                    throws java.io.IOException
Specified by:
writeLongArray in interface WritableDataPipe
Throws:
java.io.IOException

writeFloatArray

public void writeFloatArray(float[] values)
                     throws java.io.IOException
Specified by:
writeFloatArray in interface WritableDataPipe
Throws:
java.io.IOException

writeDoubleArray

public void writeDoubleArray(double[] values)
                      throws java.io.IOException
Specified by:
writeDoubleArray in interface WritableDataPipe
Throws:
java.io.IOException

writeArray

public void writeArray(java.lang.Object array,
                       int arrayLength,
                       com.metsci.glimpse.util.io.datapipe.AbstractChannel.BufferWrapper buffer)
                throws java.io.IOException
Throws:
java.io.IOException

writeString

public void writeString(java.lang.String value)
                 throws java.io.IOException
Description copied from interface: WritableDataPipe
Writes a string encoded in true UTF-8 format (not Java's modified UTF).

Specified by:
writeString in interface WritableDataPipe
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Specified by:
flush in interface WritableDataPipe
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in interface WritableDataPipe
Overrides:
close in class AbstractChannel
Throws:
java.io.IOException

getOutputStream

public java.io.DataOutputStream getOutputStream()
Specified by:
getOutputStream in interface WritableDataPipe


Copyright © 2012 Metron, Inc.. All Rights Reserved.