Package java.nio

Examples of java.nio.MappedByteBuffer.load()


        FileInputStream fileInputStream = new FileInputStream(tmpFile);
        FileChannel fileChannelRead = fileInputStream.getChannel();
        MappedByteBuffer mmbRead = fileChannelRead.map(MapMode.READ_ONLY, 0,
                fileChannelRead.size());
       
        assertEquals(mmbRead, mmbRead.load());

        RandomAccessFile randomFile = new RandomAccessFile(tmpFile, "rw");
        FileChannel fileChannelReadWrite = randomFile.getChannel();
        MappedByteBuffer mmbReadWrite = fileChannelReadWrite.map(
                FileChannel.MapMode.READ_WRITE, 0, fileChannelReadWrite.size());
View Full Code Here


        RandomAccessFile randomFile = new RandomAccessFile(tmpFile, "rw");
        FileChannel fileChannelReadWrite = randomFile.getChannel();
        MappedByteBuffer mmbReadWrite = fileChannelReadWrite.map(
                FileChannel.MapMode.READ_WRITE, 0, fileChannelReadWrite.size());

        assertEquals(mmbReadWrite, mmbReadWrite.load());
       
        fileChannelRead.close();
        fileChannelReadWrite.close();
    }
View Full Code Here

        FileInputStream fileInputStream = new FileInputStream(tmpFile);
        FileChannel fileChannelRead = fileInputStream.getChannel();
        MappedByteBuffer mmbRead = fileChannelRead.map(MapMode.READ_ONLY, 0,
                fileChannelRead.size());
       
        assertEquals(mmbRead, mmbRead.load());

        RandomAccessFile randomFile = new RandomAccessFile(tmpFile, "rw");
        FileChannel fileChannelReadWrite = randomFile.getChannel();
        MappedByteBuffer mmbReadWrite = fileChannelReadWrite.map(
                FileChannel.MapMode.READ_WRITE, 0, fileChannelReadWrite.size());
View Full Code Here

        RandomAccessFile randomFile = new RandomAccessFile(tmpFile, "rw");
        FileChannel fileChannelReadWrite = randomFile.getChannel();
        MappedByteBuffer mmbReadWrite = fileChannelReadWrite.map(
                FileChannel.MapMode.READ_WRITE, 0, fileChannelReadWrite.size());

        assertEquals(mmbReadWrite, mmbReadWrite.load());
    }

    protected void setUp() throws IOException {
        // Create temp file with 26 bytes and 5 ints
        tmpFile = File.createTempFile("harmony", "test")//$NON-NLS-1$//$NON-NLS-2$
View Full Code Here

    private void loadMappedBinary(FileInputStream is) throws IOException {
  FileChannel fc = is.getChannel();

  MappedByteBuffer bb =
      fc.map(FileChannel.MapMode.READ_ONLY, 0, (int) fc.size());
  bb.load();
  loadDatabase(bb);
  is.close();
    }

    /**
 
View Full Code Here

  throws IOException {
  FileChannel fc = is.getChannel();

  MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY,
    0, (int) fc.size());
  bb.load();
  int size = 0;
  int numEntries = 0;
  List phonemeList = new ArrayList();

  // we get better performance for some reason if we
View Full Code Here

      FileInputStream fis = (FileInputStream) is;
      FileChannel fc = fis.getChannel();

      MappedByteBuffer bb =
    fc.map(FileChannel.MapMode.READ_ONLY, 0, (int) fc.size());
      bb.load();
      loadBinary(bb);
      is.close();
  } else {
      loadBinary(new DataInputStream(is));
  }
View Full Code Here

        FileInputStream fileInputStream = new FileInputStream(tmpFile);
        FileChannel fileChannelRead = fileInputStream.getChannel();
        MappedByteBuffer mmbRead = fileChannelRead.map(MapMode.READ_ONLY, 0,
                fileChannelRead.size());
       
        assertEquals(mmbRead, mmbRead.load());

        RandomAccessFile randomFile = new RandomAccessFile(tmpFile, "rw");
        FileChannel fileChannelReadWrite = randomFile.getChannel();
        MappedByteBuffer mmbReadWrite = fileChannelReadWrite.map(
                FileChannel.MapMode.READ_WRITE, 0, fileChannelReadWrite.size());
View Full Code Here

        RandomAccessFile randomFile = new RandomAccessFile(tmpFile, "rw");
        FileChannel fileChannelReadWrite = randomFile.getChannel();
        MappedByteBuffer mmbReadWrite = fileChannelReadWrite.map(
                FileChannel.MapMode.READ_WRITE, 0, fileChannelReadWrite.size());

        assertEquals(mmbReadWrite, mmbReadWrite.load());
    }

    protected void setUp() throws IOException {
        // Create temp file with 26 bytes and 5 ints
        tmpFile = File.createTempFile("harmony", "test")//$NON-NLS-1$//$NON-NLS-2$
View Full Code Here

      long start = i * rowsPerBlock * columns * 8L;
      long size = rowsPerBlock * columns * 8L;
      MappedByteBuffer buf = new FileInputStream(f).getChannel().map(FileChannel.MapMode.READ_ONLY, start,
                                                                     Math.min(f.length() - start, size));
      if (loadNow) {
        buf.load();
      }
      addData(buf.asDoubleBuffer());
    }
  }

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.