Package java.nio

Examples of java.nio.MappedByteBuffer.duplicate()


      public Block find(long pointer) {
        final int fileSize = numBlocksPerFile * (
            numRecordsPerBlock * UserEventIndex.ID_SIZE + UserEventIndex.Block.MetaData.SIZE);
        MappedByteBuffer byteBuffer = buffers.getUnchecked((int) (pointer / fileSize));
        ByteBuffer metaDataByteBuffer = byteBuffer.duplicate();
        metaDataByteBuffer.position((int) (pointer % fileSize));
        metaDataByteBuffer = metaDataByteBuffer.slice();
        ByteBuffer blockByteBuffer = byteBuffer.duplicate();
        blockByteBuffer.position((int) (pointer % fileSize) + Block.MetaData.SIZE);
        blockByteBuffer = blockByteBuffer.slice();
View Full Code Here


            numRecordsPerBlock * UserEventIndex.ID_SIZE + UserEventIndex.Block.MetaData.SIZE);
        MappedByteBuffer byteBuffer = buffers.getUnchecked((int) (pointer / fileSize));
        ByteBuffer metaDataByteBuffer = byteBuffer.duplicate();
        metaDataByteBuffer.position((int) (pointer % fileSize));
        metaDataByteBuffer = metaDataByteBuffer.slice();
        ByteBuffer blockByteBuffer = byteBuffer.duplicate();
        blockByteBuffer.position((int) (pointer % fileSize) + Block.MetaData.SIZE);
        blockByteBuffer = blockByteBuffer.slice();
        return new Block(new Block.MetaData(metaDataByteBuffer), blockByteBuffer);
      }

View Full Code Here

            numRecordsPerBlock * UserEventIndex.ID_SIZE + UserEventIndex.Block.MetaData.SIZE);
        long pointer = currentPointer;
        MappedByteBuffer byteBuffer = buffers.getUnchecked((int) (pointer / fileSize));
        int blockSize = numRecordsPerBlock * ID_SIZE + MetaData.SIZE;
        currentPointer += blockSize;
        ByteBuffer metaDataByteBuffer = byteBuffer.duplicate();
        metaDataByteBuffer.position((int) (pointer % fileSize));
        metaDataByteBuffer = metaDataByteBuffer.slice();
        ByteBuffer blockByteBuffer = byteBuffer.duplicate();
        blockByteBuffer.position((int) (pointer % fileSize) + Block.MetaData.SIZE);
        blockByteBuffer = blockByteBuffer.slice();
View Full Code Here

        int blockSize = numRecordsPerBlock * ID_SIZE + MetaData.SIZE;
        currentPointer += blockSize;
        ByteBuffer metaDataByteBuffer = byteBuffer.duplicate();
        metaDataByteBuffer.position((int) (pointer % fileSize));
        metaDataByteBuffer = metaDataByteBuffer.slice();
        ByteBuffer blockByteBuffer = byteBuffer.duplicate();
        blockByteBuffer.position((int) (pointer % fileSize) + Block.MetaData.SIZE);
        blockByteBuffer = blockByteBuffer.slice();

        Block.MetaData metaData = new Block.MetaData(metaDataByteBuffer);
        metaData.setBlockOffset(blockOffset);
View Full Code Here

      if(LOGGER.isLoggable(Level.FINE)) {
        LOGGER.log(Level.FINE, "Using cached map for " + file.getAbsolutePath());
      }
    }
   
    return (MappedByteBuffer) buffer.duplicate();
  }
 
  /**
   * Cleans up all memory mapped regions for a specified file. It is necessary to call this
   * method before any attempt to open a file for writing on Windows
View Full Code Here

    {
      int version = bbuf.getInt();
      int ofs = bbuf.getInt();
      int size = bbuf.getInt();
      int cputype = bbuf.getInt();
      ByteBuffer wrapped = bbuf.duplicate();
      wrapped.position(ofs).limit(ofs+size);
      decode(wrapped);
    }
    System.out.println();
  }
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.