Package java.nio

Examples of java.nio.ByteBuffer.rewind()


 
  public static final int makeName(String mnemonic) {
    ByteBuffer buffer = ByteBuffer.allocate(4);
    for (int n = 0; n < buffer.limit(); n++)
      buffer.put(characterOrSpace(mnemonic, n));
    buffer.rewind();
    return buffer.asIntBuffer().get();
  }

  private static byte characterOrSpace(String mnemonic, int n) {
    return (byte) (n < mnemonic.length() ? mnemonic.charAt(n) : ' ');
View Full Code Here


      assertNotNull(data);
      assertNotNull(writtenBuffer);

      data.rewind();
      writtenBuffer.rewind();

      for (int i = 0; i < bytesWritten; i++)
      {
         byte d = data.get();
         byte w = writtenBuffer.get();
View Full Code Here

   public ByteBuffer getMemoryBuffer()
   {
      ByteBuffer copy = ByteBuffer.allocate(memBuf.limit());

      ByteBuffer rewoundCopy = memBuf.duplicate();
      rewoundCopy.rewind();

      copy.put(rewoundCopy);

      return copy;
   }
View Full Code Here

   public ByteBuffer getFileBuffer()
   {
      ByteBuffer copy = ByteBuffer.allocate(fileBuf.limit());

      ByteBuffer rewoundCopy = fileBuf.duplicate();
      rewoundCopy.rewind();

      copy.put(rewoundCopy);

      return copy;
   }
View Full Code Here

      assertNotNull(data);
      assertNotNull(writtenBuffer);

      data.rewind();
      writtenBuffer.rewind();

      for (int i = 0; i < bytesWritten; i++)
      {
         byte d = data.get();
         byte w = writtenBuffer.get();
View Full Code Here

      ByteBuffer inputBuffer = this.getWriteData(cmdRef);

      assertNotNull(inputBuffer);

      inputBuffer.rewind();

      final int returnedNumberOfBlocks = inputBuffer.getInt();

      final int returnedBlockLength = inputBuffer.getInt();
View Full Code Here

      ByteBuffer inputBuffer = this.getWriteData(cmdRef);

      assertNotNull(inputBuffer);

      inputBuffer.rewind();

      final long returnedNumberOfBlocks = inputBuffer.getLong();

      final int returnedBlockLength = inputBuffer.getInt();
View Full Code Here

   {
      ByteBuffer writtenBuffer = this.getWriteData(cmdRef);

      assertNotNull(writtenBuffer);

      writtenBuffer.rewind();

      byte responseCode = writtenBuffer.get();

      // Check that the valid bit is set
      assertEquals(1, (responseCode >> 7) & 1);
View Full Code Here

         throws InterruptedException
   {
      _logger.debug("servicing readData request: nexus: " + nexus + ", cmdRef: "
            + commandReferenceNumber);
      ByteBuffer data = this.readDataMap.get(commandReferenceNumber);
      data.rewind();
      output.put(data);
      return true;
   }

   public boolean writeData(Nexus nexus, long commandReferenceNumber, ByteBuffer input)
View Full Code Here

        if (byteBuff == null) {
            byteBuff = ByteBuffer.allocateDirect(32 + 8 + 520 + 520);
            byteBuff.order(ByteOrder.nativeOrder());
            nativeECDSABuffer.set(byteBuff);
        }
        byteBuff.rewind();
        byteBuff.put(data);
        byteBuff.putInt(signature.length);
        byteBuff.putInt(pub.length);
        byteBuff.put(signature);
        byteBuff.put(pub);
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.