List of usage examples for java.lang Exception printStackTrace
public void printStackTrace()
From source file:Main.java
public static void main(String args[]) { try {//from ww w.jav a 2 s . c om InetAddress ia = InetAddress.getByName("www.java2s.com"); DatagramSocket ds = new DatagramSocket(); byte buffer[] = "hello".getBytes(); DatagramPacket dp = new DatagramPacket(buffer, buffer.length, ia, 80); // Send the datagram packet ds.send(dp); System.out.println(ds.getSoTimeout()); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static void main(String args[]) { try {/*from www .java2 s . c o m*/ InetAddress ia = InetAddress.getByName("www.java2s.com"); DatagramSocket ds = new DatagramSocket(); byte buffer[] = "hello".getBytes(); DatagramPacket dp = new DatagramPacket(buffer, buffer.length, ia, 80); // Send the datagram packet ds.send(dp); System.out.println(ds.getReuseAddress()); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static void main(String args[]) { try {//from w ww.ja v a 2s . c om InetAddress ia = InetAddress.getByName("www.java2s.com"); DatagramSocket ds = new DatagramSocket(); byte buffer[] = "hello".getBytes(); DatagramPacket dp = new DatagramPacket(buffer, buffer.length, ia, 80); // Send the datagram packet ds.send(dp); System.out.println(ds.getReceiveBufferSize()); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static void main(String[] args) { try {//from w ww . ja v a 2 s. c o m PrintWriter pw = new PrintWriter(new FileWriter("c:/text.txt"), true); // append chars pw.append('H'); pw.append('e'); pw.append('l'); pw.append('l'); pw.append('o'); // flush the writer pw.flush(); pw.close(); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:Main.java
public static void main(String args[]) { try {/* w w w . j a v a 2 s . com*/ InetAddress ia = InetAddress.getByName("www.java2s.com"); DatagramSocket ds = new DatagramSocket(); byte buffer[] = "hello".getBytes(); DatagramPacket dp = new DatagramPacket(buffer, buffer.length, ia, 80); // Send the datagram packet ds.send(dp); System.out.println(ds.getLocalSocketAddress()); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static void main(String args[]) { try {// w w w .ja va2 s. co m InetAddress ia = InetAddress.getByName("www.java2s.com"); DatagramSocket ds = new DatagramSocket(); byte buffer[] = "hello".getBytes(); DatagramPacket dp = new DatagramPacket(buffer, buffer.length, ia, 80); // Send the datagram packet ds.send(dp); System.out.println(ds.getPort()); } catch (Exception e) { e.printStackTrace(); } }
From source file:LocalDestinationPDF.java
public static void main(String[] args) { Document document = new Document(); try {//from www . ja v a 2 s .c om PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("LocalDestinationPDF.pdf")); document.open(); document.add(new Paragraph("Page 1")); document.newPage(); document.add(new Paragraph("Page 2")); PdfContentByte cb = writer.getDirectContent(); cb.localDestination("page2", new PdfDestination(PdfDestination.XYZ, -1, 10000, 0)); writer.setOpenAction("page2"); } catch (Exception de) { de.printStackTrace(); } document.close(); }
From source file:Main.java
public static void main(String args[]) { try {// w ww.ja v a 2 s. c o m InetAddress ia = InetAddress.getByName("www.java2s.com"); DatagramSocket ds = new DatagramSocket(); byte buffer[] = "hello".getBytes(); DatagramPacket dp = new DatagramPacket(buffer, buffer.length, ia, 80); // Send the datagram packet ds.send(dp); System.out.println(ds.getTrafficClass()); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static void main(String args[]) { try {/*from w w w . ja v a 2s. co m*/ InetAddress ia = InetAddress.getByName("www.java2s.com"); DatagramSocket ds = new DatagramSocket(); byte buffer[] = "hello".getBytes(); DatagramPacket dp = new DatagramPacket(buffer, buffer.length, ia, 80); // Send the datagram packet ds.send(dp); System.out.println(ds.getLocalAddress()); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static void main(String args[]) { try {//from w w w .j a va 2 s . c om InetAddress ia = InetAddress.getByName("www.java2s.com"); DatagramSocket ds = new DatagramSocket(); byte buffer[] = "hello".getBytes(); DatagramPacket dp = new DatagramPacket(buffer, buffer.length, ia, 80); // Send the datagram packet ds.send(dp); System.out.println(ds.getLocalPort()); } catch (Exception e) { e.printStackTrace(); } }