udt
Class UDTInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by udt.UDTInputStream
All Implemented Interfaces:
Closeable

public class UDTInputStream
extends InputStream

The UDTInputStream receives data blocks from the UDTSocket as they become available, and places them into an ordered, bounded queue (the flow window) for reading by the application


Nested Class Summary
static class UDTInputStream.AppData
          used for storing application data and the associated sequence number in the queue in ascending order
 
Constructor Summary
UDTInputStream(UDTSocket socket)
          create a new UDTInputStream connected to the given socket
UDTInputStream(UDTSocket socket, UDTStatistics statistics)
          create a new UDTInputStream connected to the given socket
 
Method Summary
 void close()
           
 UDTSocket getSocket()
           
protected  boolean haveNewData(long sequenceNumber, byte[] data)
          new application data
protected  void noMoreData()
          notify the input stream that there is no more data
 int read()
           
 int read(byte[] target)
           
 int read(byte[] target, int off, int len)
           
 void setBlocking(boolean block)
          sets the blocking mode
 
Methods inherited from class java.io.InputStream
available, mark, markSupported, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UDTInputStream

public UDTInputStream(UDTSocket socket,
                      UDTStatistics statistics)
               throws IOException
create a new UDTInputStream connected to the given socket

Parameters:
socket - - the UDTSocket
statistics - - the UDTStatistics
Throws:
IOException

UDTInputStream

public UDTInputStream(UDTSocket socket)
               throws IOException
create a new UDTInputStream connected to the given socket

Parameters:
socket - - the UDTSocket
Throws:
IOException
Method Detail

read

public int read()
         throws IOException
Specified by:
read in class InputStream
Throws:
IOException

read

public int read(byte[] target,
                int off,
                int len)
         throws IOException
Overrides:
read in class InputStream
Throws:
IOException

read

public int read(byte[] target)
         throws IOException
Overrides:
read in class InputStream
Throws:
IOException

haveNewData

protected boolean haveNewData(long sequenceNumber,
                              byte[] data)
                       throws IOException
new application data

Parameters:
data -
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class InputStream
Throws:
IOException

getSocket

public UDTSocket getSocket()

setBlocking

public void setBlocking(boolean block)
sets the blocking mode

Parameters:
block -

noMoreData

protected void noMoreData()
                   throws IOException
notify the input stream that there is no more data

Throws:
IOException


Copyright © 2013 LittleShoot. All Rights Reserved.