verinec.netsim.util.net.sockets
Class BufferedSocketInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by java.io.BufferedInputStream
              extended by verinec.netsim.util.net.sockets.BufferedSocketInputStream
All Implemented Interfaces:
Closeable

public class BufferedSocketInputStream
extends BufferedInputStream

A Buffered Input Stream that reads from a SocketInputStream.

Version:
$Revision: 47 $
Author:
Dominik Jungo

Field Summary
 
Fields inherited from class java.io.BufferedInputStream
buf, count, marklimit, markpos, pos
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
BufferedSocketInputStream(SocketImpl impl)
          creates a BufferedSocketInputStream with a buffersize of SocketOptions.SO_SNDBUF
BufferedSocketInputStream(SocketImpl impl, int size)
          creates a BufferedSocketInputStream
 
Method Summary
 void addPacket(TCPPacket packet)
          adds a TCP Packet into the Inputstreams buffer
 int getAck()
          gets the address of the last part of the buffer that can be acknowledged
 
Methods inherited from class java.io.BufferedInputStream
available, close, mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.io.FilterInputStream
read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BufferedSocketInputStream

public BufferedSocketInputStream(SocketImpl impl)
                          throws IOException
creates a BufferedSocketInputStream with a buffersize of SocketOptions.SO_SNDBUF

Parameters:
impl - a SocketImpl
Throws:
IOException - if size <= 0

BufferedSocketInputStream

public BufferedSocketInputStream(SocketImpl impl,
                                 int size)
                          throws IOException
creates a BufferedSocketInputStream

Parameters:
impl - a SocketImpl
size - size of the buffer
Throws:
IOException - if size <= 0
Method Detail

getAck

public int getAck()
gets the address of the last part of the buffer that can be acknowledged

Returns:
the address of the last part of the buffer that can be acknowledged

addPacket

public void addPacket(TCPPacket packet)
               throws NetSimException
adds a TCP Packet into the Inputstreams buffer

Parameters:
packet - a TCP Packet
Throws:
NetSimException - if the packet can't be added to the buffer (the buffer is full)

Copyright © 2005 Verinec, DIUF