Examples of nextBytes()


Examples of java.security.SecureRandom.nextBytes()

            public Object run(SqlJetDb db) throws SqlJetException {
                final ISqlJetCursor c = t.open();
                try {
                    if (!c.eof()) {
                        do {
                            rnd.nextBytes(blob);

                            try {
                                c.update(rnd.nextInt(2048), blob);
                            } catch (SqlJetException e) {
                                if (!SqlJetErrorCode.CONSTRAINT.equals(e.getErrorCode())) {
View Full Code Here

Examples of java.security.SecureRandom.nextBytes()

                        if(null==argthrow misuse;
                        if( arg instanceof Integer ){
                            final Integer numBytes = (Integer) arg;
                            if( 0>=numBytes ) throw misuse;
                            final byte[] bytes = new byte[numBytes];
                            random.nextBytes(bytes);
                            return bytes;
                        } else throw misuse;
                    }
                }
            );
View Full Code Here

Examples of java.security.SecureRandom.nextBytes()

        SecureRandom rnd = new SecureRandom();
        ISqlJetTable table = db.getTable("tiles");
        for (int i = 0; i < INSERTS_COUNT; i++) {
            byte[] blob = new byte[1024 + rnd.nextInt(4096)];
            rnd.nextBytes(blob);

            int x = rnd.nextInt(2048);
            int y = 0;
            int zoom = 10;
            db.beginTransaction(SqlJetTransactionMode.WRITE);
View Full Code Here

Examples of java.security.SecureRandom.nextBytes()

            int remainder = baos.size() % 4; //if it wasn't a 4 byte inet address
            if (remainder > 0)
            {
                int pad = 4 - remainder;
                byte[] pad_bytes = new byte[pad];
                srand.nextBytes(pad_bytes);
                dos.write(pad_bytes);
            }
           
            StringBuffer sb = new StringBuffer(32);
            byte[] vmid_bytes = baos.toByteArray();
View Full Code Here

Examples of java.util.Random.nextBytes()

     
      int  len = r.nextInt(32);
     
      byte[]  x = new byte[len];
     
      r.nextBytes( x );
     
      byte[]  h1 = s1.calculateHash( x );
      byte[]  h2 = s2.calculateHash( x );
     
      if ( Arrays.equals( h1, h2)){
View Full Code Here

Examples of java.util.Random.nextBytes()

        prep.execute();

        Random random = new Random(1);
        prep.setInt(1, 3);
        byte[] large = new byte[getSize(10 * 1024, 100 * 1024)];
        random.nextBytes(large);
        prep.setBytes(2, large);
        String largeText = new String(large, "ISO-8859-1");
        prep.setString(3, largeText);
        prep.execute();

View Full Code Here

Examples of java.util.Random.nextBytes()

        byte[] buff = new byte[500000];
        for (int i = 0; i < 10; i++) {
            prep = conn.prepareStatement("insert into test values(?, ?)");
            prep.setInt(1, i);
            random.setSeed(i);
            random.nextBytes(buff);
            prep.setBinaryStream(2, new ByteArrayInputStream(buff), -1);
            prep.execute();
        }
        if (upgraded) {
            if (config.memory) {
View Full Code Here

Examples of java.util.Random.nextBytes()

            }
        }
        prep = conn.prepareStatement("select * from test where id = ?");
        for (int i = 0; i < 1; i++) {
            random.setSeed(i);
            random.nextBytes(buff);
            for (int j = 0; j < buff.length; j += 10000) {
                prep.setInt(1, i);
                ResultSet rs = prep.executeQuery();
                rs.next();
                InputStream in = rs.getBinaryStream(2);
View Full Code Here

Examples of java.util.Random.nextBytes()

    }

    private static InputStream getRandomStream(int len, int seed) {
        Random random = new Random(seed);
        byte[] buff = new byte[len];
        random.nextBytes(buff);
        return new ByteArrayInputStream(buff);
    }

}
View Full Code Here

Examples of java.util.Random.nextBytes()

        assertTrue(fs.createNewFile(fsBase + "/test"));
        assertTrue(fs.canWrite(fsBase + "/test"));
        FileObject fo = fs.openFileObject(fsBase + "/test", "rw");
        byte[] buffer = new byte[10000];
        Random random = new Random(1);
        random.nextBytes(buffer);
        fo.write(buffer, 0, 10000);
        assertEquals(10000, fo.length());
        fo.seek(20000);
        assertEquals(20000, fo.getFilePointer());
        assertThrows(EOFException.class, fo).readFully(buffer, 0, 1);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.