Package java.nio

Examples of java.nio.ByteBuffer.array()


      PartHashSet partHash = new PartHashSet(fileHash);
   
      for(int i = 0;i<partCount;i++) {
        data = Misc.getByteBuffer(16);
        fileChannel.read(data);
        partHash.add(data.array());
      }
   
      known_met_entity.setPartHashSet(partHash);
   
      data = Misc.getByteBuffer(4);
View Full Code Here


 
  public void decompress() {
    if (!isCompressed()) return;
    ByteBuffer compressedData = getByteBuffer(packet_data.limit() - 2);
    packet_data.position(2);
    packet_data.get(compressedData.array());
    packet_data.position(0);
    try {
      ByteBuffer decompressedData = JMuleZLib.decompressData(compressedData);
      decompressedData.position(0);
     
View Full Code Here

    ByteBuffer result = Misc.getByteBuffer(16);
    result.putInt(random.nextInt());
    result.putInt(random.nextInt());
    result.putInt(random.nextInt());
    result.putInt(random.nextInt());
    return result.array();
  }
 
  public static int getRandom(int range) {
    return random.nextInt(range);
  }
View Full Code Here

     
      for(int i = 1 ; i <= totalContacts ; i++) {
       
        data = getByteBuffer(16);
        channel.read(data);
        ClientID contact_id = new ClientID(data.array());
        data = getByteBuffer(4);
        channel.read(data);
        byte[] ip = data.array().clone();
        //ip = Convert.reverseArray(ip);
        IPAddress address = new IPAddress(ip);
View Full Code Here

        data = getByteBuffer(16);
        channel.read(data);
        ClientID contact_id = new ClientID(data.array());
        data = getByteBuffer(4);
        channel.read(data);
        byte[] ip = data.array().clone();
        //ip = Convert.reverseArray(ip);
        IPAddress address = new IPAddress(ip);
       
        data = getByteBuffer(2);
        channel.read(data);
View Full Code Here

        channel.read(data);
       
        ByteBuffer data2 = getByteBuffer(4);
        channel.read(data2);
       
        JKadUDPKey udp_key = new JKadUDPKey(data.array(), data2.array());
       
        data = getByteBuffer(1);
        channel.read(data);

        if (Utils.isGoodAddress(address)) {
View Full Code Here

    input.put(inputData);
    input.position(0);
    md4.update(input);
    ByteBuffer output = Misc.getByteBuffer(16);
    md4.finalDigest(output);
    return new Int128(output.array());
  }

}
View Full Code Here

      t.printStackTrace();
      Logger.getSingleton().logException(t);
      ByteBuffer unkPacket = getByteBuffer(packet.getAsByteBuffer()
          .capacity());
      packet.getAsByteBuffer().position(0);
      packet.getAsByteBuffer().get(unkPacket.array(), 0,
          packet.getAsByteBuffer().capacity());
      Logger.getSingleton().logMessage(
          "Exception in processing : \n"
              + byteToHexString(unkPacket.array(), " "));
    }
View Full Code Here

      packet.getAsByteBuffer().position(0);
      packet.getAsByteBuffer().get(unkPacket.array(), 0,
          packet.getAsByteBuffer().capacity());
      Logger.getSingleton().logMessage(
          "Exception in processing : \n"
              + byteToHexString(unkPacket.array(), " "));
    }
  }

  private void processPacket(KadPacket packet)
      throws UnknownPacketOPCodeException, CorruptedPacketException,
View Full Code Here

      packet_data.position(0);
    }

    if (packet_header != PROTO_EDONKEY_TCP) {
      throw new UnknownPacketException(packet_header, packet_opcode,
          packet_data.array());
    }
    try {
      switch (packet_opcode) {
      case PACKET_SRVMESSAGE: {
        String server_message = readString(packet_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.