Examples of pread()


Examples of freenet.support.api.RandomAccessBuffer.pread()

            int toRead = maxRead == 1 ? 1 : r.nextInt(maxRead-1)+1;
            byte[] buf = new byte[toRead];
            for(int i=0;i<buf.length;i++) buf[i] = f.getByte(i+x);
            raf.pwrite(x, buf, 0, toRead);
            for(int i=0;i<buf.length;i++) buf[i] = (byte)~buf[i];
            raf.pread(x, buf, 0, toRead);
            for(int i=0;i<buf.length;i++) assertEquals(buf[i], f.getByte(i+x));
            x += toRead;
        }
        // Read
        while(x < sz) {
View Full Code Here

Examples of freenet.support.api.RandomAccessBuffer.pread()

        // Read
        while(x < sz) {
            int maxRead = (int)Math.min(BUFFER_SIZE, sz - x);
            int toRead = r.nextInt(maxRead-1)+1;
            byte[] buf = new byte[toRead];
            raf.pread(x, buf, 0, toRead);
            for(int i=0;i<buf.length;i++) assertEquals(buf[i], f.getByte(i+x));
            x += toRead;
        }
        x = 0;
        raf.close();
View Full Code Here

Examples of freenet.support.io.TempBucketFactory.TempRandomAccessBuffer.pread()

        assertEquals(len, bucket.size());
        bucket.getInputStream().close();
        TempRandomAccessBuffer raf = (TempRandomAccessBuffer) bucket.toRandomAccessBuffer();
        bucket.free();
        try {
            raf.pread(0, new byte[len], 0, buf.length);
            fail();
        } catch (IOException e) {
            // Ok.
        }
        try {
View Full Code Here

Examples of freenet.support.io.TempBucketFactory.TempRandomAccessBuffer.pread()

        File f = ((PooledFileRandomAccessBuffer) raf.getUnderlying()).file;
        assertTrue(f.exists());
        bucket.free();
        assertFalse(f.exists());
        try {
            raf.pread(0, new byte[len], 0, buf.length);
            fail();
        } catch (IOException e) {
            // Ok.
        }
        try {
View Full Code Here

Examples of freenet.support.io.TempBucketFactory.TempRandomAccessBuffer.pread()

        File f = ((PooledFileRandomAccessBuffer) raf.getUnderlying()).file;
        assertTrue(f.exists());
        raf.free();
        assertFalse(f.exists());
        try {
            raf.pread(0, new byte[len], 0, buf.length);
            fail();
        } catch (IOException e) {
            // Ok.
        }
        try {
View Full Code Here

Examples of freenet.support.io.TempBucketFactory.TempRandomAccessBuffer.pread()

        TempRandomAccessBuffer raf = (TempRandomAccessBuffer) bucket.toRandomAccessBuffer();
        assertTrue(raf.hasMigrated());
        bucket.free();
        assertFalse(f.exists());
        try {
            raf.pread(0, new byte[len], 0, buf.length);
            fail();
        } catch (IOException e) {
            // Ok.
        }
        try {
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.