Changeset 1c6b78a


Ignore:
Timestamp:
Oct 12, 2008 4:07:23 PM (12 years ago)
Author:
sponge <sponge@…>
Branches:
master
Children:
e103f33
Parents:
8117d04
Message:

SAM davadoc cleanups
JDK5 compliance

Location:
apps/sam/java/src/net/i2p/sam
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • apps/sam/java/src/net/i2p/sam/SAMBridge.java

    r8117d04 r1c6b78a  
    9191     * Retrieve the destination associated with the given name
    9292     *
     93     * @param name name of the destination
    9394     * @return null if the name does not exist, or if it is improperly formatted
    9495     */
     
    114115     * stores it).
    115116     *
     117     * @param name Name of the destination
    116118     * @return null if the name does not exist, else the stream
    117119     */
     
    127129     * Specify that the given keystream should be used for the given name
    128130     *
     131     * @param name Name of the destination
     132     * @param stream  Name of the stream
    129133     */
    130134    public void addKeystream(String name, String stream) {
     
    195199     * allowing the bridge to specify an alternate I2CP host and port, tunnel
    196200     * depth, etc.
    197      */
     201     * @param args [[listenHost ]listenPort[ name=val]*]
     202     */
    198203    public static void main(String args[]) {
    199204        String keyfile = DEFAULT_SAM_KEYFILE;
  • apps/sam/java/src/net/i2p/sam/SAMDatagramReceiver.java

    r8117d04 r1c6b78a  
    2121     * Send a byte array to a SAM client.
    2222     *
     23     * @param sender Destination
    2324     * @param data Byte array to be received
     25     * @throws IOException
    2426     */
    2527    public void receiveDatagramBytes(Destination sender, byte data[]) throws IOException;
  • apps/sam/java/src/net/i2p/sam/SAMDatagramSession.java

    r8117d04 r1c6b78a  
    4141     * @param props Properties to setup the I2P session
    4242     * @param recv Object that will receive incoming data
     43     * @throws IOException
     44     * @throws DataFormatException
     45     * @throws I2PSessionException
    4346     */
    4447    public SAMDatagramSession(String dest, Properties props,
     
    5760     * @param props Properties to setup the I2P session
    5861     * @param recv Object that will receive incoming data
     62     * @throws IOException
     63     * @throws DataFormatException
     64     * @throws I2PSessionException
    5965     */
    6066    public SAMDatagramSession(InputStream destStream, Properties props,
     
    7076     * Send bytes through a SAM DATAGRAM session.
    7177     *
     78     * @param dest Destination
    7279     * @param data Bytes to be sent
    7380     *
    7481     * @return True if the data was sent, false otherwise
     82     * @throws DataFormatException
    7583     */
    7684    public boolean sendBytes(String dest, byte[] data) throws DataFormatException {
  • apps/sam/java/src/net/i2p/sam/SAMHandler.java

    r8117d04 r1c6b78a  
    5252     * @param verMinor SAM minor version to manage
    5353     * @param i2cpProps properties to configure the I2CP connection (host, port, etc)
     54     * @throws IOException
    5455     */
    5556    protected SAMHandler(Socket s,
     
    8384     * Get the input stream of the socket connected to the SAM client
    8485     *
     86     * @return input stream
     87     * @throws IOException
    8588     */
    8689    protected final InputStream getClientSocketInputStream() throws IOException {
     
    9497     *
    9598     * @param data A byte array to be written
     99     * @throws IOException
    96100     */
    97101    protected final void writeBytes(byte[] data) throws IOException {
     
    106110     * with getWriteLock(), synchronize against it, and write to the getOut()
    107111     *
     112     * @return socket Write lock object
    108113     */
    109114    protected Object getWriteLock() { return socketWLock; }
     
    135140     * Close the socket connected to the SAM client.
    136141     *
     142     * @throws IOException
    137143     */
    138144    protected final void closeClientSocket() throws IOException {
     
    168174     * @return A String describing the handler;
    169175     */
     176    @Override
    170177    public final String toString() {
    171178        return ("SAM handler (class: " + this.getClass().getName()
  • apps/sam/java/src/net/i2p/sam/SAMMessageSession.java

    r8117d04 r1c6b78a  
    4444     * @param dest Base64-encoded destination (private key)
    4545     * @param props Properties to setup the I2P session
     46     * @throws IOException
     47     * @throws DataFormatException
     48     * @throws I2PSessionException
    4649     */
    4750    protected SAMMessageSession(String dest, Properties props) throws IOException, DataFormatException, I2PSessionException {
     
    5861     * @param destStream Input stream containing the destination keys
    5962     * @param props Properties to setup the I2P session
     63     * @throws IOException
     64     * @throws DataFormatException
     65     * @throws I2PSessionException
    6066     */
    6167    protected SAMMessageSession(InputStream destStream, Properties props) throws IOException, DataFormatException, I2PSessionException {
     
    8591     * Send bytes through a SAM message-based session.
    8692     *
     93     * @param dest Destination
    8794     * @param data Bytes to be sent
    8895     *
    8996     * @return True if the data was sent, false otherwise
     97     * @throws DataFormatException
    9098     */
    9199    public abstract boolean sendBytes(String dest, byte[] data) throws DataFormatException;
     
    95103     * (er...).
    96104     *
     105     * @param dest Destination
    97106     * @param data Bytes to be sent
    98107     *
    99108     * @return True if the data was sent, false otherwise
     109     * @throws DataFormatException
    100110     */
    101111    protected boolean sendBytesThroughMessageSession(String dest, byte[] data) throws DataFormatException {
     
    125135    /**
    126136     * Handle a new received message
     137     * @param msg Message payload
    127138     */
    128139    protected abstract void messageReceived(byte[] msg);
     
    157168         *
    158169         * @param destStream Input stream containing the destination keys
    159          * @param props Properties to setup the I2P session
     170         * @param props Properties to setup the I2P session
     171         * @throws I2PSessionException
    160172         */
    161173        public SAMMessageSessionHandler(InputStream destStream, Properties props) throws I2PSessionException {
  • apps/sam/java/src/net/i2p/sam/SAMRawReceiver.java

    r8117d04 r1c6b78a  
    2121     *
    2222     * @param data Byte array to be received
     23     * @throws IOException
    2324     */
    2425    public void receiveRawBytes(byte data[]) throws IOException;
  • apps/sam/java/src/net/i2p/sam/SAMRawSession.java

    r8117d04 r1c6b78a  
    3434     * @param props Properties to setup the I2P session
    3535     * @param recv Object that will receive incoming data
     36     * @throws IOException
     37     * @throws DataFormatException
     38     * @throws I2PSessionException
    3639     */
    3740    public SAMRawSession(String dest, Properties props,
     
    4851     * @param props Properties to setup the I2P session
    4952     * @param recv Object that will receive incoming data
     53     * @throws IOException
     54     * @throws DataFormatException
     55     * @throws I2PSessionException
    5056     */
    5157    public SAMRawSession(InputStream destStream, Properties props,
     
    6268     *
    6369     * @return True if the data was sent, false otherwise
     70     * @throws DataFormatException
    6471     */
    6572    public boolean sendBytes(String dest, byte[] data) throws DataFormatException {
  • apps/sam/java/src/net/i2p/sam/SAMStreamReceiver.java

    r8117d04 r1c6b78a  
    2020    /**
    2121     * Sends the result of a stream send operation
     22     * @param id Stream ID
     23     * @param result information
     24     * @param bufferState state of the buffer
     25     * @throws IOException
    2226     */
    2327    public void streamSendAnswer( int id, String result, String bufferState ) throws IOException;
     
    2529    /**
    2630     * Notifies that the outwards buffer is free for writing
     31     * @param id stream ID
     32     * @throws IOException
    2733     */
    2834    public void notifyStreamSendBufferFree( int id ) throws IOException;
     
    3238     *
    3339     * @param id New connection id
     40     * @param dest Destination
     41     * @throws IOException
    3442     */
    3543    public void notifyStreamIncomingConnection ( int id, Destination dest ) throws IOException;
     
    3947     *
    4048     * @param id New connection id
     49     * @param result message result
     50     * @param msg Message
     51     * @throws IOException
    4152     */
    4253    public void notifyStreamOutgoingConnection(int id, String result, String msg) throws IOException;
     
    4859     * @param data Byte array to be received
    4960     * @param len Number of bytes in data
     61     * @throws IOException
    5062     */
    5163    public void receiveStreamBytes(int id, byte data[], int len) throws IOException;
     
    5870     * @param result Disconnection reason ("OK" or something else)
    5971     * @param msg Error message, if any
     72     * @throws IOException
    6073     */
    6174    public void notifyStreamDisconnection(int id, String result, String msg) throws IOException;
  • apps/sam/java/src/net/i2p/sam/SAMStreamSession.java

    r8117d04 r1c6b78a  
    8484     * @param props Properties to setup the I2P session
    8585     * @param recv Object that will receive incoming data
     86     * @throws IOException
     87     * @throws DataFormatException
     88     * @throws SAMException
    8689     */
    8790    public SAMStreamSession(String dest, String dir, Properties props,
     
    101104     * @param props Properties to setup the I2P session
    102105     * @param recv Object that will receive incoming data
     106     * @throws IOException
     107     * @throws DataFormatException
     108     * @throws SAMException
    103109     */
    104110    public SAMStreamSession(InputStream destStream, String dir,
     
    183189     * @param props Options to be used for connection
    184190     *
     191     * @return true if successful
    185192     * @throws DataFormatException if the destination is not valid
    186193     * @throws SAMInvalidDirectionException if trying to connect through a
     
    190197     * @throws InterruptedIOException if the connection timeouts
    191198     * @throws I2PException if there's another I2P-related error
     199     * @throws IOException
    192200     */
    193201    public boolean connect ( int id, String dest, Properties props ) throws I2PException, ConnectException, NoRouteToHostException, DataFormatException, InterruptedIOException, SAMInvalidDirectionException, IOException {
     
    225233     * Send bytes through a SAM STREAM session.
    226234     *
    227      * @param data Bytes to be sent
    228      *
     235     * @param id Stream Id
     236     * @param in Datastream input
     237     * @param size Count of bytes to send
    229238     * @return True if the data was queued for sending, false otherwise
     239     * @throws IOException
    230240     */
    231241    public boolean sendBytes(int id, InputStream in, int size) throws IOException {
     
    265275     *
    266276     * @param id Connection id
     277     * @return true on success
    267278     */
    268279    public boolean closeConnection(int id) {
     
    324335     *
    325336     * @param id Handler id
     337     * @return SAM StreamSender handler
    326338     */
    327339    protected SAMStreamSessionSocketReader getSocketReader ( int id ) {
     
    340352     *
    341353     * @param id Handler id
     354     * @return True if in use
    342355     */
    343356    protected boolean checkSocketHandlerId ( int id ) {
     
    504517         *
    505518         * @param s Socket to be handled
    506          * @param id Unique id assigned to the handler
     519         * @param id Unique id assigned to the handler
     520         * @throws IOException
    507521         */
    508522        public SAMStreamSessionSocketReader ( I2PSocket s, int id ) throws IOException {}
     
    527541         *
    528542         * @param s Socket to be handled
    529          * @param id Unique id assigned to the handler
     543         * @param id Unique id assigned to the handler
     544         * @throws IOException
    530545         */
    531546
     
    542557         *
    543558         */
     559        @Override
    544560        public void stopRunning() {
    545561            _log.debug("stopRunning() invoked on socket reader " + id);
     
    552568        }
    553569
     570        @Override
    554571        public void run() {
    555572            _log.debug("run() called for socket reader " + id);
     
    606623         * Send bytes through the SAM STREAM session socket sender
    607624         *
    608          * @param data Data to be sent
    609          *
     625         * @param in Data input stream
     626         * @param size Count of bytes to send
    610627         * @throws IOException if the client didnt provide enough data
    611628         */
     
    656673         * Send bytes through the SAM STREAM session socket sender
    657674         *
    658          * @param data Data to be sent
    659          *
    660675         * @throws IOException if the client didnt provide enough data
    661676         */
     677        @Override
    662678        public void sendBytes(InputStream in, int size) throws IOException {
    663679            if (_log.shouldLog(Log.DEBUG))
     
    680696         *
    681697         */
     698        @Override
    682699        public void stopRunning() {
    683700            _log.debug("stopRunning() invoked on socket sender " + _id);
     
    702719         * sender thread once all pending data has been sent.
    703720         */
     721        @Override
    704722        public void shutDownGracefully() {
    705723            _log.debug("shutDownGracefully() invoked on socket sender " + _id);
     
    707725        }
    708726
     727        @Override
    709728        public void run() {
    710729            _log.debug("run() called for socket sender " + _id);
  • apps/sam/java/src/net/i2p/sam/SAMv1Handler.java

    r8117d04 r1c6b78a  
    5858     * @param verMajor SAM major version to manage (should be 1)
    5959     * @param verMinor SAM minor version to manage
     60     * @throws SAMException
     61     * @throws IOException
    6062     */
    6163    public SAMv1Handler(Socket s, int verMajor, int verMinor) throws SAMException, IOException {
     
    7173     * @param verMinor SAM minor version to manage
    7274     * @param i2cpProps properties to configure the I2CP connection (host, port, etc)
     75     * @throws SAMException
     76     * @throws IOException
    7377     */
    7478    public SAMv1Handler(Socket s, int verMajor, int verMinor, Properties i2cpProps) throws SAMException, IOException {
  • apps/sam/java/src/net/i2p/sam/SAMv2StreamSession.java

    r8117d04 r1c6b78a  
    4848                 * @param props Properties to setup the I2P session
    4949                 * @param recv Object that will receive incoming data
     50                 * @throws IOException
     51                 * @throws DataFormatException
     52                 * @throws SAMException
    5053                 */
    5154                public SAMv2StreamSession ( String dest, String dir, Properties props,
     
    6265                 * @param props Properties to setup the I2P session
    6366                 * @param recv Object that will receive incoming data
     67                 * @throws IOException
     68                 * @throws DataFormatException
     69                 * @throws SAMException
    6470                 */
    6571                public SAMv2StreamSession ( InputStream destStream, String dir,
     
    8288                 */
    8389
     90                @Override
    8491                public boolean connect ( int id, String dest, Properties props )
    8592                throws DataFormatException, SAMInvalidDirectionException
     
    216223                                * Lets us push data through the stream without blocking, (even after exceeding
    217224                                * the I2PSocket's buffer)
    218                 */
    219 
     225                 *
     226                 * @param s I2PSocket
     227                 * @param id Socket ID
     228                 * @return v2StreamSender
     229                 * @throws IOException
     230                 */
     231
     232                @Override
    220233                protected StreamSender newStreamSender ( I2PSocket s, int id ) throws IOException
    221234                {
     
    223236                }
    224237
     238                @Override
    225239                protected SAMStreamSessionSocketReader
    226240                                newSAMStreamSessionSocketReader(I2PSocket s, int id ) throws IOException
     
    257271                                                * Send bytes through the SAM STREAM session socket sender
    258272                                                *
    259                                                 * @param data Data to be sent
    260                                                 *
    261                                                 * @throws IOException if the client didnt provide enough data
     273                                 * @param in Data stream of data to send
     274                                 * @param size Count of bytes to send
     275                                 * @throws IOException if the client didnt provide enough data
    262276                                */
     277                                @Override
    263278                                public void sendBytes ( InputStream in, int size ) throws IOException
    264279                                {
     
    304319                                                *
    305320                                */
     321                                @Override
    306322                                public void stopRunning()
    307323                                {
     
    336352                                                * sender thread once all pending data has been sent.
    337353                                */
     354                                @Override
    338355                                public void shutDownGracefully()
    339356                                {
     
    342359                                }
    343360
     361                                @Override
    344362                                public void run()
    345363                                {
     
    421439
    422440                /**
    423                                 * Send bytes through a SAM STREAM session.
    424                                 *
    425                                 * @param data Bytes to be sent
    426                                 *
    427                                 * @return True if the data was queued for sending, false otherwise
     441                 * Send bytes through a SAM STREAM session.
     442                 *
     443                 * @param id Stream ID
     444                 * @param limit limitation
     445                 * @param nolimit true to limit
     446                 * @return True if the data was queued for sending, false otherwise
    428447                */
     448                @Override
    429449                public boolean setReceiveLimit ( int id, long limit, boolean nolimit )
    430450                {
  • apps/sam/java/src/net/i2p/sam/client/SAMEventHandler.java

    r8117d04 r1c6b78a  
    2727    }
    2828   
     29        @Override
    2930    public void helloReplyReceived(boolean ok) {
    3031        synchronized (_helloLock) {
     
    3738    }
    3839
     40        @Override
    3941    public void sessionStatusReceived(String result, String destination, String msg) {
    4042        synchronized (_sessionCreateLock) {
     
    4749    }
    4850
     51        @Override
    4952    public void namingReplyReceived(String name, String result, String value, String msg) {
    5053        synchronized (_namingReplyLock) {
     
    5760    }
    5861
     62        @Override
    5963    public void unknownMessageReceived(String major, String minor, Properties params) {
    6064        _log.error("wrt, [" + major + "] [" + minor + "] [" + params + "]");
     
    6973     * Wait for the connection to be established, returning true if everything
    7074     * went ok
     75     * @return true if everything ok
    7176     */
    7277    public boolean waitForHelloReply() {
     
    8691     * Wait for the session to be created, returning true if everything went ok
    8792     *
     93     * @return true if everything ok
    8894     */
    8995    public boolean waitForSessionCreateReply() {
     
    105111     *
    106112     * @param name name to be looked for, or "ME"
     113     * @return destination found matching the name, or null
    107114     */
    108115    public String waitForNamingReply(String name) {
  • apps/sam/java/src/net/i2p/sam/client/SAMStreamSend.java

    r8117d04 r1c6b78a  
    5555        _samPort = samPort;
    5656        _destFile = destFile;
    57         _dataFile = dataFile;;
     57        _dataFile = dataFile;
    5858        _conOptions = "";
    5959        _eventHandler = new SendEventHandler(_context);
  • apps/sam/java/src/net/i2p/sam/client/SAMStreamSink.java

    r8117d04 r1c6b78a  
    7979    private class SinkEventHandler extends SAMEventHandler {
    8080        public SinkEventHandler(I2PAppContext ctx) { super(ctx); }
     81                @Override
    8182        public void streamClosedReceived(String result, int id, String message) {
    8283            Sink sink = null;
     
    9192            }
    9293        }
     94                @Override
    9395        public void streamDataReceived(int id, byte data[], int offset, int length) {
    9496            Sink sink = null;
     
    102104            }
    103105        }
     106                @Override
    104107        public void streamConnectedReceived(String dest, int id) { 
    105108            _log.debug("Connection " + id + " received from " + dest);
Note: See TracChangeset for help on using the changeset viewer.