Package java.nio

Examples of java.nio.ByteBuffer.array()


   
    do {
     
      ByteBuffer tmpData = Misc.getByteBuffer(BLOCK_SIZE);
     
      byte_count = decompressor.inflate(tmpData.array());
   
      tmpData.limit(byte_count);
     
      vector.add(tmpData);
     
View Full Code Here


    File file = new File(USER_HASH_FILE);
    if (!file.exists()) return ;
    FileChannel input_channel = new FileInputStream(file).getChannel();
    ByteBuffer hash = Misc.getByteBuffer(16);
    input_channel.read(hash);
    user_hash = new UserHash(hash.array());
    input_channel.close();
  }
 
  private void storeClientID() throws Throwable {
    FileChannel output_channel = new FileOutputStream(KAD_ID_FILE).getChannel();
View Full Code Here

    File file = new File(KAD_ID_FILE);
    if (!file.exists()) return ;
    FileChannel input_channel = new FileInputStream(file).getChannel();
    ByteBuffer data = Misc.getByteBuffer(16);
    input_channel.read(data);
    client_id = new ClientID(data.array());
  }
 
  public void load() throws ConfigurationManagerException {
    try {
       config_store.load( new FileInputStream( CONFIG_FILE ) );
View Full Code Here

          return;
        }

        default: {
          throw new UnknownPacketException(packet_protocol,
              packet_op_code, packet_content.array());
        }
        }
      }
      }
    } catch (Throwable cause) {
View Full Code Here

      }
      }
    } catch (Throwable cause) {
      if (cause instanceof UnknownPacketException)
        throw (UnknownPacketException) cause;
      throw new MalformattedPacketException(packet_content.array(), cause);
    }
  }

  private static TagList readTagList(ByteBuffer packet) {
    int tag_count = packet.getInt();
View Full Code Here

    int message_length = (packet.getShort());
    ByteBuffer bytes = Misc.getByteBuffer(message_length);
    bytes.position(0);
    for (int i = 0; i < message_length; i++)
      bytes.put(packet.get());
    return new String(bytes.array());
  }

}
View Full Code Here

    int count = data.getInt(0);
   
    for(int i=0;i<count;i++) {
      data = getByteBuffer(16);
      channel.read(data);
      Int128 key_id = new Int128(data.array());
      data = getByteBuffer(4);
      channel.read(data);
      Index index = new Index(key_id);
      int source_count = data.getInt(0);
   
View Full Code Here

      int source_count = data.getInt(0);
   
      for(int j = 0;j<source_count;j++) {
        data = getByteBuffer(16);
        channel.read(data);
        ClientID client_id = new ClientID(data.array());

        data = getByteBuffer(8);
        channel.read(data);
        long creation_time = data.getLong(0);
        data = getByteBuffer(1);
View Full Code Here

    KadPacket packet = new KadPacket(KADEMLIA2_PUBLISH_SOURCE_REQ,
        16 + 1 + tag_list.capacity());

    packet.insertData(sourceID.toByteArray());
    packet.insertData(Convert.intToByte(tagList.size()));
    packet.insertData(tag_list.array());

    return packet;

  }
View Full Code Here

      this.modDate = data.getInt(0);
     
      //Load file hash
      data = Misc.getByteBuffer(16);
      fileChannel.read(data);
      fileHash = new FileHash(data.array());
      fileHashSet = new PartHashSet(fileHash);
     
      //Read part count
      data = Misc.getByteBuffer(2);
      fileChannel.read(data);
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.