Changeset 824d5a0


Ignore:
Timestamp:
Dec 26, 2010 12:42:44 PM (9 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
b3d1a76
Parents:
3497337
Message:

javadocs

Location:
core/java/src/net/i2p
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/data/DataHelper.java

    r3497337 r824d5a0  
    915915    }
    916916
     917    /**
     918     *  This is different than InputStream.read(target), in that it
     919     *  does repeated reads until the full data is received.
     920     */
    917921    public static int read(InputStream in, byte target[]) throws IOException {
    918922        return read(in, target, 0, target.length);
    919923    }
     924
     925    /**
     926     *  This is different than InputStream.read(target, offset, length), in that it
     927     *  returns the new offset (== old offset + bytes read).
     928     *  It also does repeated reads until the full data is received.
     929     *  @return the new offset (== old offset + bytes read)
     930     */
    920931    public static int read(InputStream in, byte target[], int offset, int length) throws IOException {
    921932        int cur = offset;
  • core/java/src/net/i2p/data/Destination.java

    r3497337 r824d5a0  
    2929    }
    3030
    31     /** deprecated, used only by Packet.java in streaming */
     31    /**
     32     *  deprecated, used only by Packet.java in streaming
     33     *  @return the written length (NOT the new offset)   
     34     */   
    3235    public int writeBytes(byte target[], int offset) {
    3336        int cur = offset;
  • core/java/src/net/i2p/data/Payload.java

    r3497337 r824d5a0  
    9494            _log.debug("wrote payload: " + _encryptedData.length);
    9595    }
     96
     97    /**
     98     *  @return the written length (NOT the new offset)   
     99     */   
    96100    public int writeBytes(byte target[], int offset) {
    97101        if (_encryptedData == null) throw new IllegalStateException("Not yet encrypted.  Please set the encrypted data");
  • core/java/src/net/i2p/util/FortunaRandomSource.java

    r3497337 r824d5a0  
    2424 */
    2525public class FortunaRandomSource extends RandomSource implements EntropyHarvester {
    26     private AsyncFortunaStandalone _fortuna;
     26    private final AsyncFortunaStandalone _fortuna;
    2727    private double _nextGaussian;
    2828    private boolean _haveNextGaussian;
     
    211211    }
    212212   
     213/*****
    213214    public static void main(String args[]) {
    214215        try {
     
    232233        } catch (Exception e) { e.printStackTrace(); }
    233234    }
     235*****/
    234236}
  • core/java/src/net/i2p/util/RandomSource.java

    r3497337 r824d5a0  
    2626 */
    2727public class RandomSource extends SecureRandom implements EntropyHarvester {
    28     private Log _log;
    29     private EntropyHarvester _entropyHarvester;
    30     protected I2PAppContext _context;
     28    private final EntropyHarvester _entropyHarvester;
     29    protected final I2PAppContext _context;
    3130
    3231    public RandomSource(I2PAppContext context) {
    3332        super();
    3433        _context = context;
    35         _log = context.logManager().getLog(RandomSource.class);
    3634        // when we replace to have hooks for fortuna (etc), replace with
    3735        // a factory (or just a factory method)
    3836        _entropyHarvester = this;
    3937    }
     38
     39    /**
     40     * Singleton for whatever PRNG i2p uses. 
     41     * Same as I2PAppContext.getGlobalContext().random();
     42     * use context.random() if you have a context already.
     43     * @return I2PAppContext.getGlobalContext().random()
     44     */
    4045    public static RandomSource getInstance() {
    4146        return I2PAppContext.getGlobalContext().random();
Note: See TracChangeset for help on using the changeset viewer.