org.python.core.io
Class ServerSocketIO

java.lang.Object
  extended by org.python.core.io.IOBase
      extended by org.python.core.io.RawIOBase
          extended by org.python.core.io.SocketIOBase
              extended by org.python.core.io.ServerSocketIO

public class ServerSocketIO
extends SocketIOBase

Raw I/O implementation for server sockets.

Author:
Philip Jenvey

Field Summary
 
Fields inherited from class org.python.core.io.IOBase
DEFAULT_BUFFER_SIZE
 
Constructor Summary
ServerSocketIO(ServerSocketChannel socketChannel, String mode)
          Construct a ServerSocketIO for the given ServerSocketChannel.
 
Method Summary
 void close()
          Flushes and closes the IO object.
 Channel getChannel()
          Return the underlying Java nio Channel.
 int readinto(ByteBuffer buf)
          Read up to buf.remaining() bytes into buf.
 int write(ByteBuffer buf)
          Write the given ByteBuffer to the IO stream.
 
Methods inherited from class org.python.core.io.SocketIOBase
readable, writable
 
Methods inherited from class org.python.core.io.RawIOBase
fileno, read, readall, readinto, write
 
Methods inherited from class org.python.core.io.IOBase
asInputStream, asOutputStream, checkClosed, checkReadable, checkWritable, closed, flush, isatty, seek, seek, tell, truncate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerSocketIO

public ServerSocketIO(ServerSocketChannel socketChannel,
                      String mode)
Construct a ServerSocketIO for the given ServerSocketChannel.

Parameters:
socketChannel - a ServerSocketChannel to wrap
mode - a raw io socket mode String
Method Detail

readinto

public int readinto(ByteBuffer buf)
Description copied from class: RawIOBase
Read up to buf.remaining() bytes into buf. Returns number of bytes read (0 for EOF).

Overrides:
readinto in class RawIOBase
Parameters:
buf - a ByteBuffer to read bytes into
Returns:
the amount of data read as an int

write

public int write(ByteBuffer buf)
Description copied from class: RawIOBase
Write the given ByteBuffer to the IO stream. Returns the number of bytes written, which may be less than buf.remaining().

Overrides:
write in class RawIOBase
Parameters:
buf - a ByteBuffer value
Returns:
the number of bytes written as an int

close

public void close()
Description copied from class: IOBase
Flushes and closes the IO object. This must be idempotent. It should also set a flag for the 'closed' property (see below) to test.

Overrides:
close in class IOBase

getChannel

public Channel getChannel()
Description copied from class: RawIOBase
Return the underlying Java nio Channel.

Specified by:
getChannel in class RawIOBase
Returns:
the underlying Java nio Channel


Jython homepage