java.io.Closeable
, java.lang.AutoCloseable
, SAMMessageSess
SAMv2StreamSession
, SAMv3StreamSession
class SAMStreamSession extends java.lang.Object implements SAMMessageSess
修飾子とタイプ | クラス | 説明 |
---|---|---|
protected class |
SAMStreamSession.DisconnectListener |
|
class |
SAMStreamSession.SAMStreamSessionServer |
SAM STREAM session server, running in its own thread.
|
class |
SAMStreamSession.SAMStreamSessionSocketReader |
SAM STREAM socket reader, running in its own thread.
|
class |
SAMStreamSession.SAMv1StreamSessionSocketReader |
|
protected static class |
SAMStreamSession.StreamSender |
Lets us push data through the stream without blocking, (even after exceeding
the I2PSocket's buffer)
|
修飾子とタイプ | フィールド | 説明 |
---|---|---|
protected boolean |
_isOwnSession |
|
protected Log |
_log |
|
protected boolean |
canCreate |
|
static java.lang.String |
DEFAULT_FORCE_FLUSH |
|
protected boolean |
forceFlush |
should we flush every time we get a STREAM SEND, or leave that up to
the streaming lib to decide?
|
static java.lang.String |
PROP_FORCE_FLUSH |
|
protected SAMStreamReceiver |
recv |
|
protected SAMStreamSession.SAMStreamSessionServer |
server |
|
protected static int |
SOCKET_HANDLER_BUF_SIZE |
|
protected I2PSocketManager |
socketMgr |
修飾子 | コンストラクタ | 説明 |
---|---|---|
protected |
SAMStreamSession(java.io.InputStream destStream,
java.lang.String dir,
java.util.Properties props,
SAMStreamReceiver recv) |
Create a new SAM STREAM session.
|
|
SAMStreamSession(java.lang.String dest,
java.lang.String dir,
java.util.Properties props,
SAMStreamReceiver recv) |
Create a new SAM STREAM session.
|
protected |
SAMStreamSession(I2PSocketManager mgr,
java.util.Properties props,
SAMStreamReceiver recv,
int listenport) |
Create a new SAM STREAM session on an existing socket manager.
|
修飾子とタイプ | メソッド | 説明 |
---|---|---|
protected boolean |
checkSocketHandlerId(int id) |
Check whether a SAM STREAM session socket handler id is still in use.
|
void |
close() |
Close a SAM STREAM session.
|
boolean |
closeConnection(int id) |
Close a connection managed by the SAM STREAM session.
|
boolean |
connect(int id,
java.lang.String dest,
java.util.Properties props) |
Connect the SAM STREAM session to the specified Destination
|
protected int |
createSocketHandler(I2PSocket s,
int id) |
Create a new SAM STREAM session socket handler, detaching its thread.
|
Destination |
getDestination() |
Get the SAM STREAM session Destination.
|
int |
getListenPort() |
|
int |
getListenProtocol() |
|
protected SAMStreamSession.SAMStreamSessionSocketReader |
getSocketReader(int id) |
Get a SAM STREAM session socket handler.
|
protected SAMStreamSession.SAMStreamSessionSocketReader |
newSAMStreamSessionSocketReader(I2PSocket s,
int id) |
|
protected SAMStreamSession.StreamSender |
newStreamSender(I2PSocket s,
int id) |
|
protected void |
removeSocketHandler(int id) |
Remove and gracefully close a SAM STREAM session socket handler.
|
boolean |
sendBytes(int id,
java.io.InputStream in,
int size) |
Send bytes through a SAM STREAM session.
|
boolean |
sendBytes(java.lang.String s,
byte[] b,
int pr,
int fp,
int tp) |
Unsupported
|
boolean |
sendBytes(java.lang.String s,
byte[] b,
int pr,
int fp,
int tp,
boolean sendLeaseSet,
int sendTags,
int tagThreshold,
int expiration) |
Unsupported
|
(package private) boolean |
setReceiveLimit(int id,
long limit,
boolean nolimit) |
|
void |
start() |
Start a SAM message-based session.
|
protected final Log _log
protected static final int SOCKET_HANDLER_BUF_SIZE
protected final SAMStreamReceiver recv
protected final SAMStreamSession.SAMStreamSessionServer server
protected final I2PSocketManager socketMgr
protected final boolean canCreate
protected final boolean _isOwnSession
protected final boolean forceFlush
public static final java.lang.String PROP_FORCE_FLUSH
public static final java.lang.String DEFAULT_FORCE_FLUSH
public SAMStreamSession(java.lang.String dest, java.lang.String dir, java.util.Properties props, SAMStreamReceiver recv) throws java.io.IOException, DataFormatException, SAMException
dest
- Base64-encoded destination and private keys (same format as PrivateKeyFile)dir
- Session direction ("RECEIVE", "CREATE" or "BOTH") or "__v3__" if extended by SAMv3StreamSessionprops
- Properties to setup the I2P sessionrecv
- Object that will receive incoming datajava.io.IOException
DataFormatException
SAMException
protected SAMStreamSession(java.io.InputStream destStream, java.lang.String dir, java.util.Properties props, SAMStreamReceiver recv) throws java.io.IOException, DataFormatException, SAMException
destStream
- Input stream containing the destination and private keys (same format as PrivateKeyFile)dir
- Session direction ("RECEIVE", "CREATE" or "BOTH") or "__v3__" if extended by SAMv3StreamSessionprops
- Properties to setup the I2P sessionrecv
- Object that will receive incoming datajava.io.IOException
DataFormatException
SAMException
protected SAMStreamSession(I2PSocketManager mgr, java.util.Properties props, SAMStreamReceiver recv, int listenport) throws java.io.IOException, DataFormatException, SAMException
props
- Properties to setup the I2P sessionrecv
- Object that will receive incoming datajava.io.IOException
DataFormatException
SAMException
public void start()
SAMMessageSess
start
インタフェース内 SAMMessageSess
public int getListenProtocol()
getListenProtocol
インタフェース内 SAMMessageSess
public int getListenPort()
getListenPort
インタフェース内 SAMMessageSess
public Destination getDestination()
getDestination
インタフェース内 SAMMessageSess
public boolean connect(int id, java.lang.String dest, java.util.Properties props) throws I2PException, java.net.ConnectException, java.net.NoRouteToHostException, DataFormatException, java.io.InterruptedIOException, SAMInvalidDirectionException, java.io.IOException
id
- Unique id for the connectiondest
- Base64-encoded Destination to connect toprops
- Options to be used for connectionDataFormatException
- if the destination is not validSAMInvalidDirectionException
- if trying to connect through a
receive-only sessionjava.net.ConnectException
- if the destination refuses connectionsjava.net.NoRouteToHostException
- if the destination can't be reachedjava.io.InterruptedIOException
- if the connection timeoutsI2PException
- if there's another I2P-related errorjava.io.IOException
public boolean sendBytes(int id, java.io.InputStream in, int size) throws java.io.IOException
id
- Stream Idin
- Datastream inputsize
- Count of bytes to sendjava.io.IOException
public void close()
close
インタフェース内 java.lang.AutoCloseable
close
インタフェース内 java.io.Closeable
close
インタフェース内 SAMMessageSess
public boolean closeConnection(int id)
id
- Connection idpublic boolean sendBytes(java.lang.String s, byte[] b, int pr, int fp, int tp) throws I2PSessionException
sendBytes
インタフェース内 SAMMessageSess
s
- Destinationb
- Bytes to be sentI2PSessionException
- alwayspublic boolean sendBytes(java.lang.String s, byte[] b, int pr, int fp, int tp, boolean sendLeaseSet, int sendTags, int tagThreshold, int expiration) throws I2PSessionException
sendBytes
インタフェース内 SAMMessageSess
I2PSessionException
- alwaysprotected int createSocketHandler(I2PSocket s, int id)
s
- Socket to be handledid
- Socket id, or 0 if it must be auto-generatedprotected SAMStreamSession.SAMStreamSessionSocketReader getSocketReader(int id)
id
- Handler idprotected boolean checkSocketHandlerId(int id)
id
- Handler idprotected void removeSocketHandler(int id)
id
- Handler id to be removedboolean setReceiveLimit(int id, long limit, boolean nolimit)
protected SAMStreamSession.SAMStreamSessionSocketReader newSAMStreamSessionSocketReader(I2PSocket s, int id) throws java.io.IOException
java.io.IOException
protected SAMStreamSession.StreamSender newStreamSender(I2PSocket s, int id) throws java.io.IOException
java.io.IOException