Examples of array()


Examples of java.nio.ByteBuffer.array()

    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

Examples of java.nio.ByteBuffer.array()

      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

Examples of java.nio.ByteBuffer.array()

      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

Examples of java.nio.ByteBuffer.array()

      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

Examples of java.nio.ByteBuffer.array()

      Packet packet = new Packet(4+data_length, PROTO_EDONKEY_TCP);
      packet.setCommand(OP_OFFERFILES);
      packet.insertData(sharedFiles.size());
     
      for(ByteBuffer buffer : shared_files_data)
        packet.insertData(buffer.array());
     
      return packet;
    }
   
   // =======================
View Full Code Here

Examples of java.nio.ByteBuffer.array()

          packet_data.get(file_hash);
          long chunk_start = Convert.intToLong(packet_data.getInt());
          long chunk_end = Convert.intToLong(packet_data.getInt());
          ByteBuffer chunk_content = Misc.getByteBuffer(chunk_end
              - chunk_start);
          packet_data.get(chunk_content.array());
          _network_manager.receivedRequestedFileChunkFromPeer(peerIP,
              peerPort, new FileHash(file_hash), new FileChunk(
                  chunk_start, chunk_end, chunk_content));

          break;
View Full Code Here

Examples of java.nio.ByteBuffer.array()

          byte[] file_hash = new byte[16];
          packet_data.get(file_hash);
          int name_length = Convert
              .shortToInt(packet_data.getShort());
          ByteBuffer str_bytes = Misc.getByteBuffer(name_length);
          packet_data.get(str_bytes.array());
          _network_manager.receivedFileRequestAnswerFromPeer(peerIP,
              peerPort, new FileHash(file_hash), new String(
                  str_bytes.array()));
          break;
        }
View Full Code Here

Examples of java.nio.ByteBuffer.array()

              .shortToInt(packet_data.getShort());
          ByteBuffer str_bytes = Misc.getByteBuffer(name_length);
          packet_data.get(str_bytes.array());
          _network_manager.receivedFileRequestAnswerFromPeer(peerIP,
              peerPort, new FileHash(file_hash), new String(
                  str_bytes.array()));
          break;
        }

        case OP_FILEREQANSNOFILE: {
          byte[] file_hash = new byte[16];
View Full Code Here

Examples of java.nio.ByteBuffer.array()

        case OP_MESSAGE: {
          int message_length = Convert.shortToInt(packet_data
              .getShort());
          ByteBuffer message_bytes = Misc
              .getByteBuffer(message_length);
          packet_data.get(message_bytes.array());
          String message = new String(message_bytes.array());
          message_bytes.clear();
          message_bytes = null;
          _peer_manager.receivedMessage(peerIP, peerPort, message);
          break;
View Full Code Here

Examples of java.nio.ByteBuffer.array()

     
      for(FileChunkRequest request : partsData) {
        num.clear();
        num.rewind();
        num.putInt(Convert.longToInt(request.getChunkBegin()));
        packet.insertData(num.array());
      }
     
      for(FileChunkRequest request : partsData) {
        num.clear();
        num.rewind();
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.