Examples of JFormatter


Examples of com.sun.codemodel.JFormatter

  public static final String generableToString(JGenerable generable) {
    // There is hardly any clean universal way to get the value from e.g. JExpression except of serializing it.
    // Compare JStringLiteral and JExp#dotclass().
    Writer w = new StringWriter();

    generable.generate(new JFormatter(w));

    // FIXME: Hopefully nobody will put quotes into annotation member value.
    return w.toString().replace("\"", "");
  }
View Full Code Here

Examples of org.jnetpcap.packet.format.JFormatter

    Ip4.RecordRoute record = new Ip4.RecordRoute();

    JPacket packet =
        TestUtils.getPcapPacket("tests/test-icmp-recordroute-opt.pcap", 0);

    JFormatter out = new TextFormatter();
    out.format(packet);
   
    assertNotNull(packet);
    assertTrue(packet.hasHeader(ip));
    assertTrue(ip.hasSubHeaders());
    assertFalse(ip.hasSubHeader(lsroute));
View Full Code Here

Examples of org.jnetpcap.packet.format.JFormatter

    JPacket packet = TestUtils.getPcapPacket("tests/test-afs.pcap", 0);

    if (packet.hasHeader(JProtocol.IP4_ID)) {
      ip = packet.getHeader(ip);
      JFormatter out = new TextFormatter(System.out);
      out.format(ip, Detail.MULTI_LINE_FULL_DETAIL);
    }

  }
View Full Code Here

Examples of org.jnetpcap.packet.format.JFormatter

   *
   * @throws IOException
   *           Signals that an I/O exception has occurred.
   */
  public void testHttpFormattingWithResolveAddressDisabled() throws IOException {
    JFormatter out = new TextFormatter(OUT);
    out.setResolveAddresses(false);

    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);
    }

    out.format(packet);

    Html html = new Html();
    assertTrue("html header not found", packet.hasHeader(html));
    System.out.printf("link related tags=%s\n", Arrays.asList(html.links())
        .toString());
View Full Code Here

Examples of org.jnetpcap.packet.format.JFormatter

  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

Examples of org.jnetpcap.packet.format.JFormatter

   *
   * @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

Examples of org.jnetpcap.packet.format.JFormatter

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

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

Examples of org.jnetpcap.packet.format.JFormatter

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

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

Examples of org.jnetpcap.packet.format.JFormatter

   *
   * @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

Examples of org.jnetpcap.packet.format.JFormatter

   * Gets a string with summary information about the header.
   *
   * @return String with summary of the header
   */
  public String toString() {
    JFormatter out = JPacket.getFormatter();
    out.reset();
    try {
      out.format(this);
    } catch (IOException e) {
      throw new IllegalStateException("Unexpected StringBuilder IO error");
    }
    return out.toString();
  }
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.