Package java.nio

Examples of java.nio.ByteBuffer.position()


    if (read == -1) {  // EOF
      reachedEOF = true;
      IOLoop.INSTANCE.updateHandler(channel, interestOps &= ~SelectionKey.OP_READ);
      return;
    }
    readBuffer.append(new String(buffer.array(), 0, buffer.position(), Charsets.ISO_8859_1));
    logger.debug("readBuffer size: {}", readBuffer.length());
    checkReadState();
  }

  /**
 
View Full Code Here


      assert address != null;
      byteBuffer.put(address.getValue());
      //Upper Layer Packet Length
      byteBuffer.putInt(icmpPrtlBytes);
      //3octet zero
      byteBuffer.position(byteBuffer.position() + 3);
      //Next Header
      byteBuffer.put(ICMP_NEXT_HEADER);
    }
   
  }
View Full Code Here

      assert address != null;
      byteBuffer.put(address.getValue());
      //Upper Layer Packet Length
      byteBuffer.putInt(icmpPrtlBytes);
      //3octet zero
      byteBuffer.position(byteBuffer.position() + 3);
      //Next Header
      byteBuffer.put(ICMP_NEXT_HEADER);
    }
   
  }
View Full Code Here

      //ipv4 destination address
      oStr = (IOctetstringValue)ipv4Header.getField(
          Ipv4TypeEVExtFactory.IPV4_HEADER_DESTINATION_ADDRESS);
      pseudoBuffer.put(oStr.getValue());
      //zero
      pseudoBuffer.position(pseudoBuffer.position() + 1);
      //ipv4 protocol
      IIntegerValue iValue = (IIntegerValue)ipv4Header.getField(
          Ipv4TypeEVExtFactory.IPV4_HEADER_PROTOCOL);
      pseudoBuffer.put((byte)iValue.getInteger());
      //segment length
View Full Code Here

      //ipv4 destination address
      oStr = (IOctetstringValue)ipv4Header.getField(
          Ipv4TypeEVExtFactory.IPV4_HEADER_DESTINATION_ADDRESS);
      pseudoBuffer.put(oStr.getValue());
      //zero
      pseudoBuffer.position(pseudoBuffer.position() + 1);
      //ipv4 protocol
      IIntegerValue iValue = (IIntegerValue)ipv4Header.getField(
          Ipv4TypeEVExtFactory.IPV4_HEADER_PROTOCOL);
      pseudoBuffer.put((byte)iValue.getInteger());
      //segment length
View Full Code Here

      assert address != null;
      pseudoBuffer.put(address.getValue());
      //Upper Layer Packet Length
      pseudoBuffer.putInt(upperPrtlBytes);
      //3octet zero
      pseudoBuffer.position(pseudoBuffer.position() + 3);
      //Next Header
      if (isUdp) {
        pseudoBuffer.put(UDP_NEXT_HEADER);
      } else {
        pseudoBuffer.put(TCP_NEXT_HEADER);
View Full Code Here

      assert address != null;
      pseudoBuffer.put(address.getValue());
      //Upper Layer Packet Length
      pseudoBuffer.putInt(upperPrtlBytes);
      //3octet zero
      pseudoBuffer.position(pseudoBuffer.position() + 3);
      //Next Header
      if (isUdp) {
        pseudoBuffer.put(UDP_NEXT_HEADER);
      } else {
        pseudoBuffer.put(TCP_NEXT_HEADER);
View Full Code Here

                if(c == -1 || c == 0)
                    terminate=true;

                if(buf.remaining() == 0 || terminate) {
                    if(body == null) {
                        body=new byte[buf.position()];
                        System.arraycopy(buf.array(), buf.arrayOffset(), body, 0, buf.position());
                    }
                    else {
                        byte[] tmp=new byte[body.length + buf.position()];
                        System.arraycopy(body, 0, tmp, 0, body.length);
View Full Code Here

                    terminate=true;

                if(buf.remaining() == 0 || terminate) {
                    if(body == null) {
                        body=new byte[buf.position()];
                        System.arraycopy(buf.array(), buf.arrayOffset(), body, 0, buf.position());
                    }
                    else {
                        byte[] tmp=new byte[body.length + buf.position()];
                        System.arraycopy(body, 0, tmp, 0, body.length);
                        try {
View Full Code Here

                    if(body == null) {
                        body=new byte[buf.position()];
                        System.arraycopy(buf.array(), buf.arrayOffset(), body, 0, buf.position());
                    }
                    else {
                        byte[] tmp=new byte[body.length + buf.position()];
                        System.arraycopy(body, 0, tmp, 0, body.length);
                        try {
                            System.arraycopy(buf.array(), buf.arrayOffset(), tmp, body.length, buf.position());
                        }
                        catch(Throwable t) {
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.