Examples of migrateToDisk()


Examples of freenet.support.io.TempBucketFactory.TempBucket.migrateToDisk()

        OutputStream os = bucket.getOutputStream();
        os.write(buf.clone());
        os.close();
        assertTrue(bucket.isRAMBucket());
        assertEquals(len, bucket.size());
        assertTrue(bucket.migrateToDisk());
        TempRandomAccessBuffer raf = (TempRandomAccessBuffer) bucket.toRandomAccessBuffer();
        assertTrue(raf != null);
        raf = (TempRandomAccessBuffer) bucket.toRandomAccessBuffer();
        assertTrue(raf != null);
        raf.close();
View Full Code Here

Examples of freenet.support.io.TempBucketFactory.TempBucket.migrateToDisk()

        assertEquals(len, bucket.size());
        bucket.getInputStream().close();
        TempRandomAccessBuffer raf = (TempRandomAccessBuffer) bucket.toRandomAccessBuffer();
        assertTrue(raf.migrateToDisk());
        assertFalse(raf.migrateToDisk());
        assertFalse(bucket.migrateToDisk());
        assertTrue(raf.hasMigrated());
        File f = ((PooledFileRandomAccessBuffer) raf.getUnderlying()).file;
        assertTrue(f.exists());
        bucket.free();
        assertFalse(f.exists());
View Full Code Here

Examples of freenet.support.io.TempBucketFactory.TempBucket.migrateToDisk()

        os.write(buf.clone());
        os.close();
        assertTrue(bucket.isRAMBucket());
        assertEquals(len, bucket.size());
        bucket.getInputStream().close();
        bucket.migrateToDisk();
        File f = getFile(bucket);
        assertTrue(f.exists());
        TempRandomAccessBuffer raf = (TempRandomAccessBuffer) bucket.toRandomAccessBuffer();
        assertTrue(raf.hasMigrated());
        bucket.free();
View Full Code Here

Examples of freenet.support.io.TempBucketFactory.TempBucket.migrateToDisk()

        os.write(buf.clone());
        os.close();
        assertTrue(bucket.isRAMBucket());
        assertEquals(len, bucket.size());
        // Migrate to disk
        bucket.migrateToDisk();
        assertFalse(bucket.isRAMBucket());
        File f = getFile(bucket);
        assertTrue(f.exists());
        if(enableCrypto())
            assertEquals(f.length(), 8192);
View Full Code Here

Examples of freenet.support.io.TempBucketFactory.TempBucket.migrateToDisk()

     
      TempBucket bucket = (TempBucket) tbf.makeBucket(64);
      OutputStream os = bucket.getOutputStreamUnbuffered();
      os.write(new byte[16]);
      InputStream is = bucket.getInputStream();
      bucket.migrateToDisk();
      byte[] readTo = new byte[16];
      assertTrue(is.read(readTo, 0, 16) == 16);
      for(int i=0;i<readTo.length;i++)
        assertTrue(readTo[i] == 0);
      is.close();
View Full Code Here

Examples of freenet.support.io.TempBucketFactory.TempBucket.migrateToDisk()

      OutputStream os = bucket.getOutputStreamUnbuffered();
      byte[] data = new byte[2048];
      new Random(89).nextBytes(data);
      os.write(data);
      InputStream is = bucket.getInputStream();
      bucket.migrateToDisk();
      byte[] readTo = new byte[2048];
      new DataInputStream(is).readFully(readTo);
      for(int i=0;i<readTo.length;i++)
        assertTrue(readTo[i] == data[i]);
      is.close();
View Full Code Here

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

        r.nextBytes(buf);
        RandomAccessBuffer raf = construct(len);
        TempRandomAccessBuffer t = (TempRandomAccessBuffer) raf;
        assertFalse(t.hasMigrated());
        assertEquals(factory.getRamUsed(), len);
        t.migrateToDisk();
        assertTrue(t.hasMigrated());
        assertEquals(factory.getRamUsed(), 0);
        raf.pwrite(0L, buf, 0, buf.length);
        checkArrayInner(buf, raf, len, r);
        raf.close();
View Full Code Here

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

        }
        assertEquals(len, raf.size());
        assertFalse(raf.hasMigrated());
        checkArrayInner(buf, raf, len, r);
        // Now migrate to disk.
        raf.migrateToDisk();
        File f = ((PooledFileRandomAccessBuffer) raf.getUnderlying()).file;
        assertTrue(f.exists());
        assertEquals(len, f.length());
        assertTrue(raf.hasMigrated());
        assertEquals(factory.getRamUsed(), 0);
View Full Code Here

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

        os.close();
        assertTrue(bucket.isRAMBucket());
        assertEquals(len, bucket.size());
        bucket.getInputStream().close();
        TempRandomAccessBuffer raf = (TempRandomAccessBuffer) bucket.toRandomAccessBuffer();
        assertTrue(raf.migrateToDisk());
        assertFalse(raf.migrateToDisk());
        assertFalse(bucket.migrateToDisk());
        assertTrue(raf.hasMigrated());
        File f = ((PooledFileRandomAccessBuffer) raf.getUnderlying()).file;
        assertTrue(f.exists());
View Full Code Here

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

        assertTrue(bucket.isRAMBucket());
        assertEquals(len, bucket.size());
        bucket.getInputStream().close();
        TempRandomAccessBuffer raf = (TempRandomAccessBuffer) bucket.toRandomAccessBuffer();
        assertTrue(raf.migrateToDisk());
        assertFalse(raf.migrateToDisk());
        assertFalse(bucket.migrateToDisk());
        assertTrue(raf.hasMigrated());
        File f = ((PooledFileRandomAccessBuffer) raf.getUnderlying()).file;
        assertTrue(f.exists());
        bucket.free();
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.