Top Description Fields Constructors Methods
org.python.core.io

public abstract Class SocketIOBase<T extends Channel>

extends RawIOBase
Class Inheritance
Known Direct Subclasses
org.python.core.io.DatagramSocketIO, org.python.core.io.ServerSocketIO, org.python.core.io.SocketIO
Imports
java.io.IOException, java.nio.channels.Channel, org.python.core.Py

Base raw I/O implementation for sockets.
Author
Philip Jenvey

Field Summary

Modifier and TypeField and Description
private boolean
readable

true if the socket is allowed to be read from

protected T
socketChannel

The underlying socket

private boolean
writable

true if the socket is allowed to be written to

Constructor Summary

AccessConstructor and Description
public
SocketIOBase(T
a Channel to wrap
socketChannel
,
String
a raw io socket mode String
mode
)

Construct a SocketIOBase for the given socket Channel

Method Summary

Modifier and TypeMethod and Description
public void
close()

Overrides org.python.core.io.IOBase.close.

Flushes and closes the IO object.

public T
getChannel()

Implements abstract org.python.core.io.RawIOBase.getChannel.

Return the underlying Java nio Channel.

protected void
parseMode(String
a raw io socket mode String
mode
)

Parse the raw io socket mode string.

public boolean
readable()

Overrides org.python.core.io.IOBase.readable.

Return whether this file was opened for reading.

public boolean
writable()

Overrides org.python.core.io.IOBase.writable.

Return whether this file was opened for writing.

Inherited from org.python.core.io.RawIOBase:
filenoreadreadallreadintoreadintowritewrite

Field Detail

readableback to summary
private boolean readable

true if the socket is allowed to be read from

socketChannelback to summary
protected T socketChannel

The underlying socket

writableback to summary
private boolean writable

true if the socket is allowed to be written to

Constructor Detail

SocketIOBaseback to summary
public SocketIOBase(T socketChannel, String mode)

Construct a SocketIOBase for the given socket Channel

Parameters
socketChannel:T

a Channel to wrap

mode:String

a raw io socket mode String

Method Detail

closeback to summary
public void close()

Overrides org.python.core.io.IOBase.close.

Doc from org.python.core.io.IOBase.close.

Flushes and closes the IO object. This must be idempotent. It should also set a flag for the 'closed' property (see below) to test.

Annotations
@Override
getChannelback to summary
public T getChannel()

Implements abstract org.python.core.io.RawIOBase.getChannel.

Doc from org.python.core.io.RawIOBase.getChannel.

Return the underlying Java nio Channel.

Returns:T

the underlying Java nio Channel

Annotations
@Override

parseModeback to summary
protected void parseMode(String mode)

Parse the raw io socket mode string. The mode can be 'r', 'w' or 'rw' for reading, writing or reading and writing.

Parameters
mode:String

a raw io socket mode String

readableback to summary
public boolean readable()

Overrides org.python.core.io.IOBase.readable.

Doc from org.python.core.io.IOBase.readable.

Return whether this file was opened for reading.

Returns:boolean

true if the file was opened for reading

Annotations
@Override

writableback to summary
public boolean writable()

Overrides org.python.core.io.IOBase.writable.

Doc from org.python.core.io.IOBase.writable.

Return whether this file was opened for writing.

Returns:boolean

true if the file was opened for writing

Annotations
@Override