|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.sam.SAMStreamSession
public class SAMStreamSession
SAM STREAM session class.
Nested Class Summary | |
---|---|
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 class |
SAMStreamSession.StreamSender
Lets us push data through the stream without blocking, (even after exceeding the I2PSocket's buffer) |
protected class |
SAMStreamSession.v1StreamSender
|
Field Summary | |
---|---|
protected boolean |
canCreate
|
static 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 String |
PROP_FORCE_FLUSH
|
protected SAMStreamReceiver |
recv
|
protected SAMStreamSession.SAMStreamSessionServer |
server
|
protected static int |
SOCKET_HANDLER_BUF_SIZE
|
protected I2PSocketManager |
socketMgr
|
Constructor Summary | |
---|---|
SAMStreamSession(InputStream destStream,
String dir,
Properties props,
SAMStreamReceiver recv)
Create a new SAM STREAM session. |
|
SAMStreamSession(String dest,
String dir,
Properties props,
SAMStreamReceiver recv)
Create a new SAM STREAM session. |
Method Summary | |
---|---|
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,
String dest,
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. |
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,
InputStream in,
int size)
Send bytes through a SAM STREAM session. |
(package private) boolean |
setReceiveLimit(int id,
long limit,
boolean nolimit)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final int SOCKET_HANDLER_BUF_SIZE
protected final SAMStreamReceiver recv
protected final SAMStreamSession.SAMStreamSessionServer server
protected final I2PSocketManager socketMgr
protected boolean canCreate
protected final boolean forceFlush
public static String PROP_FORCE_FLUSH
public static String DEFAULT_FORCE_FLUSH
Constructor Detail |
---|
public SAMStreamSession(String dest, String dir, Properties props, SAMStreamReceiver recv) throws IOException, DataFormatException, SAMException
dest
- Base64-encoded destination (private key)dir
- Session direction ("RECEIVE", "CREATE" or "BOTH")props
- Properties to setup the I2P sessionrecv
- Object that will receive incoming data
IOException
DataFormatException
SAMException
public SAMStreamSession(InputStream destStream, String dir, Properties props, SAMStreamReceiver recv) throws IOException, DataFormatException, SAMException
destStream
- Input stream containing the destination keysdir
- Session direction ("RECEIVE", "CREATE" or "BOTH")props
- Properties to setup the I2P sessionrecv
- Object that will receive incoming data
IOException
DataFormatException
SAMException
Method Detail |
---|
public Destination getDestination()
public boolean connect(int id, String dest, Properties props) throws I2PException, ConnectException, NoRouteToHostException, DataFormatException, InterruptedIOException, SAMInvalidDirectionException, IOException
id
- Unique id for the connectiondest
- Base64-encoded Destination to connect toprops
- Options to be used for connection
DataFormatException
- if the destination is not valid
SAMInvalidDirectionException
- if trying to connect through a
receive-only session
ConnectException
- if the destination refuses connections
NoRouteToHostException
- if the destination can't be reached
InterruptedIOException
- if the connection timeouts
I2PException
- if there's another I2P-related error
IOException
public boolean sendBytes(int id, InputStream in, int size) throws IOException
id
- Stream Idin
- Datastream inputsize
- Count of bytes to send
IOException
public void close()
public boolean closeConnection(int id)
id
- Connection id
protected int createSocketHandler(I2PSocket s, int id)
s
- Socket to be handledid
- Socket id, or 0 if it must be auto-generated
protected SAMStreamSession.SAMStreamSessionSocketReader getSocketReader(int id)
id
- Handler id
protected boolean checkSocketHandlerId(int id)
id
- Handler id
protected 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 IOException
IOException
protected SAMStreamSession.StreamSender newStreamSender(I2PSocket s, int id) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |