Package org.jnetpcap.packet.format

Examples of org.jnetpcap.packet.format.TextFormatter


  public void testHttpFormattingWithResolveAddressEnabled() throws IOException {
    JLogger.getLogger(JConfig.class).setLevel(Level.FINE);

    JLogger.getLogger(Resolver.class.getPackage()).setLevel(Level.FINER);

    JFormatter out = new TextFormatter(OUT);
    out.setResolveAddresses(true);

    PcapPacket packet = TestUtils.getPcapPacket("tests/test-http-jpeg.pcap", 5);

    Ip4 ip = new Ip4();
    Ethernet eth = new Ethernet();
    if (packet.hasHeader(eth)) {
      out.format(eth);
    }
    if (packet.hasHeader(ip)) {
      // out.format(ip);
      out.format(ip);
      System.out.println();
    }

    // out.format(packet);
View Full Code Here


    final ByteBuffer byteBuffer = ByteBuffer.allocate(8 * 1024);

    final ReferenceQueue<PcapPacket> refQueue =
        new ReferenceQueue<PcapPacket>();

    final TextFormatter out = new TextFormatter(DEV_NULL);

    // Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
    Thread.currentThread().setPriority(Thread.NORM_PRIORITY);
    // Thread.currentThread().setPriority(Thread.MIN_PRIORITY);

View Full Code Here

   *
   * @throws IOException
   *           Signals that an I/O exception has occurred.
   */
  public void testTextFormatter() throws IOException {
    JFormatter out = new TextFormatter(OUT);
   
    JPacket packet = TestUtils.getPcapPacket("tests/test-vlan.pcap", 0);
    try {
      out.format(packet);
     
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

   *
   * @throws IOException
   *           Signals that an I/O exception has occurred.
   */
  public void testSubHeader() throws IOException {
    JFormatter out = new TextFormatter(OUT);
   
    JPacket packet = TestUtils.getPcapPacket("tests/test-afs.pcap", 0);

    out.format(packet);
  }
View Full Code Here

   *           Signals that an I/O exception has occurred.
   */
  public void test1() throws IOException {
    JPacket packet = getPcapPacket(HTTP, 5);

    JFormatter out = new TextFormatter(System.out);

    out.format(packet);
  }
View Full Code Here

TOP

Related Classes of org.jnetpcap.packet.format.TextFormatter

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.