Package org.jnetpcap.nio

Examples of org.jnetpcap.nio.JBuffer


   * @return 0 on success, -1 on error and -2 if breakloop was used interrupt
   *         the captue
   * @since 1.2
   */
  public <T> int loop(int cnt, JBufferHandler<T> handler, T user) {
    return loop(cnt, handler, user, new PcapHeader(Type.POINTER), new JBuffer(
        Type.POINTER));
  }
View Full Code Here


   * </pre>
   */
  public JMemoryPacket(byte[] buffer) {
    super(Type.POINTER);

    final JBuffer mem = getMemoryBuffer(buffer);
    super.peer(mem);

    header.setWirelen(buffer.length);
  }
View Full Code Here

  public JMemoryPacket(ByteBuffer buffer) throws PeeringException {
    super(Type.POINTER);
   
    final int size = buffer.limit() - buffer.position();

    final JBuffer mem = getMemoryBuffer(size);
    super.peer(mem);
   
    transferFrom(buffer);

    header.setWirelen(size);
View Full Code Here

    super(POINTER);

    header.setWirelen(buffer.size());

    final int len = buffer.size();
    JBuffer b = getMemoryBuffer(len);

    b.transferFrom(buffer); // Make a buffer to buffer copy

    peer(b, 0, len);
   
    header.setWirelen(len);
  }
View Full Code Here

   * </pre>
   *
   * @return number of bytes copied
   */
  public int transferStateAndDataFrom(byte[] buffer) {
    JBuffer b = getMemoryBuffer(buffer);

    return peerStateAndData(b, 0);
  }
View Full Code Here

   *
   * @return number of bytes copied
   */
  public int transferStateAndDataFrom(ByteBuffer buffer) {
    final int len = buffer.limit() - buffer.position();
    JBuffer b = getMemoryBuffer(len);

    b.transferFrom(buffer, 0);

    return peerStateAndData(b, 0);
  }
View Full Code Here

   *
   * @return number of bytes copied
   */
  public int transferStateAndDataFrom(JBuffer buffer) {
    final int len = buffer.size();
    JBuffer b = getMemoryBuffer(len);

    b.transferFrom(buffer);

    return peerStateAndData(b, 0);
  }
View Full Code Here

   *          source packet
   * @return number of bytes copied
   */
  public int transferStateAndDataFrom(JPacket packet) {
    int len = packet.state.size() + packet.size();
    JBuffer mem = getMemoryBuffer(len);

    int o = packet.state.transferTo(mem, 0, packet.state.size(), 0);
    o += packet.transferTo(mem, 0, packet.size(), o);

    return o;
View Full Code Here

   * @param packet
   *          destination packet
   * @return number of bytes copied
   */
  public int transferStateAndDataTo(JMemoryPacket packet) {
    final JBuffer buffer = packet.getMemoryBuffer(this.getTotalSize());

    packet.transferStateAndDataTo(buffer, 0);

    return peerStateAndData(buffer, 0);
  }
View Full Code Here

   *          sequentially in the buffer
   * @return number of bytes copied
   */
  public int transferStateAndDataFrom(byte[] buffer) {

    JBuffer b = getMemoryBuffer(buffer);

    return peerStateAndData(b, 0);
  }
View Full Code Here

TOP

Related Classes of org.jnetpcap.nio.JBuffer

Copyright © 2018 www.massapicom. 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.