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

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

public class ReadableDataChannel
extends AbstractChannel
implements ReadableDataPipe

An implementation of ReadableDataPipe that uses nio.

Author:
hogye

Constructor Summary
ReadableDataChannel(java.nio.channels.ReadableByteChannel channel)
           
 
Method Summary
 java.io.DataInputStream getInputStream()
           
 long getTotalBytesRead()
           
 void readArray(java.lang.Object array, int arrayLength, com.metsci.glimpse.util.io.datapipe.AbstractChannel.BufferWrapper buffer)
           
 boolean readBoolean()
           
 boolean[] readBooleanArray(boolean[] values)
           
 byte readByte()
           
 byte[] readByteArray(byte[] values)
           
 double readDouble()
           
 double[] readDoubleArray(double[] values)
           
 float readFloat()
           
 float[] readFloatArray(float[] values)
           
 int readInt()
           
 int[] readIntArray(int[] values)
           
 long readLong()
           
 long[] readLongArray(long[] values)
           
 short readShort()
           
 short[] readShortArray(short[] values)
           
 java.lang.String readString()
          Reads a string encoded in true UTF-8 format (not Java's modified UTF).
 
Methods inherited from class com.metsci.glimpse.util.io.datapipe.AbstractChannel
close, getChannel
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.metsci.glimpse.util.io.datapipe.ReadableDataPipe
close
 

Constructor Detail

ReadableDataChannel

public ReadableDataChannel(java.nio.channels.ReadableByteChannel channel)
                    throws java.io.IOException
Throws:
java.io.IOException
Method Detail

getTotalBytesRead

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

readBoolean

public boolean readBoolean()
                    throws java.io.IOException
Specified by:
readBoolean in interface ReadableDataPipe
Throws:
java.io.IOException

readByte

public byte readByte()
              throws java.io.IOException
Specified by:
readByte in interface ReadableDataPipe
Throws:
java.io.IOException

readShort

public short readShort()
                throws java.io.IOException
Specified by:
readShort in interface ReadableDataPipe
Throws:
java.io.IOException

readInt

public int readInt()
            throws java.io.IOException
Specified by:
readInt in interface ReadableDataPipe
Throws:
java.io.IOException

readLong

public long readLong()
              throws java.io.IOException
Specified by:
readLong in interface ReadableDataPipe
Throws:
java.io.IOException

readFloat

public float readFloat()
                throws java.io.IOException
Specified by:
readFloat in interface ReadableDataPipe
Throws:
java.io.IOException

readDouble

public double readDouble()
                  throws java.io.IOException
Specified by:
readDouble in interface ReadableDataPipe
Throws:
java.io.IOException

readBooleanArray

public boolean[] readBooleanArray(boolean[] values)
                           throws java.io.IOException
Specified by:
readBooleanArray in interface ReadableDataPipe
Throws:
java.io.IOException

readByteArray

public byte[] readByteArray(byte[] values)
                     throws java.io.IOException
Specified by:
readByteArray in interface ReadableDataPipe
Throws:
java.io.IOException

readShortArray

public short[] readShortArray(short[] values)
                       throws java.io.IOException
Specified by:
readShortArray in interface ReadableDataPipe
Throws:
java.io.IOException

readIntArray

public int[] readIntArray(int[] values)
                   throws java.io.IOException
Specified by:
readIntArray in interface ReadableDataPipe
Throws:
java.io.IOException

readLongArray

public long[] readLongArray(long[] values)
                     throws java.io.IOException
Specified by:
readLongArray in interface ReadableDataPipe
Throws:
java.io.IOException

readFloatArray

public float[] readFloatArray(float[] values)
                       throws java.io.IOException
Specified by:
readFloatArray in interface ReadableDataPipe
Throws:
java.io.IOException

readDoubleArray

public double[] readDoubleArray(double[] values)
                         throws java.io.IOException
Specified by:
readDoubleArray in interface ReadableDataPipe
Throws:
java.io.IOException

readArray

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

readString

public java.lang.String readString()
                            throws java.io.IOException
Description copied from interface: ReadableDataPipe
Reads a string encoded in true UTF-8 format (not Java's modified UTF).

Specified by:
readString in interface ReadableDataPipe
Throws:
java.io.IOException

getInputStream

public java.io.DataInputStream getInputStream()
Specified by:
getInputStream in interface ReadableDataPipe


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