Package java.util

Examples of java.util.Random.nextBytes()


    public void testBucketToRAFFreeWhileFile() throws IOException {
        int len = 4095;
        Random r = new Random(21162101);
        TempBucket bucket = (TempBucket) factory.makeBucket(1024);
        byte[] buf = new byte[len];
        r.nextBytes(buf);
        OutputStream os = bucket.getOutputStream();
        os.write(buf.clone());
        os.close();
        assertTrue(bucket.isRAMBucket());
        assertEquals(len, bucket.size());
View Full Code Here


    public void testBucketToRAFFreeWhileFileFreeRAF() throws IOException {
        int len = 4095;
        Random r = new Random(21162101);
        TempBucket bucket = (TempBucket) factory.makeBucket(1024);
        byte[] buf = new byte[len];
        r.nextBytes(buf);
        OutputStream os = bucket.getOutputStream();
        os.write(buf.clone());
        os.close();
        assertTrue(bucket.isRAMBucket());
        assertEquals(len, bucket.size());
View Full Code Here

    public void testBucketToRAFFreeWhileFileMigrateFirst() throws IOException {
        int len = 4095;
        Random r = new Random(21162101);
        TempBucket bucket = (TempBucket) factory.makeBucket(1024);
        byte[] buf = new byte[len];
        r.nextBytes(buf);
        OutputStream os = bucket.getOutputStream();
        os.write(buf.clone());
        os.close();
        assertTrue(bucket.isRAMBucket());
        assertEquals(len, bucket.size());
View Full Code Here

    public void testBucketToRAFWhileFile() throws IOException {
        int len = 4095;
        Random r = new Random(21162101);
        TempBucket bucket = (TempBucket) factory.makeBucket(1024);
        byte[] buf = new byte[len];
        r.nextBytes(buf);
        OutputStream os = bucket.getOutputStream();
        os.write(buf.clone());
        os.close();
        assertTrue(bucket.isRAMBucket());
        assertEquals(len, bucket.size());
View Full Code Here

    public void testBucketToRAFFailure() throws IOException {
        int len = 4095;
        Random r = new Random(21162101);
        TempBucket bucket = (TempBucket) factory.makeBucket(1024);
        byte[] buf = new byte[len];
        r.nextBytes(buf);
        OutputStream os = bucket.getOutputStream();
        os.write(buf.clone());
        assertTrue(bucket.isRAMBucket());
        try {
            bucket.toRandomAccessBuffer();
View Full Code Here

        PooledFileRandomAccessBuffer a = construct(sz);
        PooledFileRandomAccessBuffer b = construct(sz);
        byte[] buf1 = new byte[sz];
        byte[] buf2 = new byte[sz];
        Random r = new Random(1153);
        r.nextBytes(buf1);
        r.nextBytes(buf2);
        a.pwrite(0, buf1, 0, buf1.length);
        b.pwrite(0, buf2, 0, buf2.length);
        byte[] cmp1 = new byte[sz];
        byte[] cmp2 = new byte[sz];
View Full Code Here

        PooledFileRandomAccessBuffer b = construct(sz);
        byte[] buf1 = new byte[sz];
        byte[] buf2 = new byte[sz];
        Random r = new Random(1153);
        r.nextBytes(buf1);
        r.nextBytes(buf2);
        a.pwrite(0, buf1, 0, buf1.length);
        b.pwrite(0, buf2, 0, buf2.length);
        byte[] cmp1 = new byte[sz];
        byte[] cmp2 = new byte[sz];
        a.pread(0, cmp1, 0, cmp1.length);
View Full Code Here

public class DataInputBufferTest {
    @Test
    public void testRandom() throws IOException {
        Random random = new Random();
        byte[] bytes = new byte[1024*1024];
        random.nextBytes(bytes);

        DataInputBuffer.FastByteArrayInputStream bis = new DataInputBuffer.FastByteArrayInputStream(bytes);
        int read = 0;
        int n = 0;
        while ( true )
View Full Code Here

    streamingHash64Factory = classInstance("net.jpountz.xxhash.StreamingXXHash64" + impl + "$Factory");

    // make sure it can run
    final byte[] bytes = new byte[100];
    final Random random = new Random();
    random.nextBytes(bytes);
    final int seed = random.nextInt();

    final int h1 = hash32.hash(bytes, 0, bytes.length, seed);
    final StreamingXXHash32 streamingHash32 = newStreamingHash32(seed);
    streamingHash32.update(bytes, 0, bytes.length);
View Full Code Here

    final ApnsPayloadBuilder builder = new ApnsPayloadBuilder();
    final Random random = new Random();

    for (int i = 0; i < NOTIFICATIONS_PER_TEST; i++) {
      final byte[] token = new byte[32];
      random.nextBytes(token);

      builder.setAlertBody(new BigInteger(1024, new Random()).toString(16));

      this.notifications.add(new SimpleApnsPushNotification(token, builder.buildWithDefaultMaximumLength()));
    }
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.