List of usage examples for java.lang Exception printStackTrace
public void printStackTrace()
From source file:Main.java
public static void main(String[] args) { byte[] arrByte = new byte[1024]; byte[] byteArray = new byte[] { 'j', 'a', 'v', 'a', '2', 's', '.', 'c', 'o', 'm' }; InputStream is = new ByteArrayInputStream(byteArray); PushbackInputStream pis = new PushbackInputStream(is); try {/* ww w . j a va2 s . c om*/ for (int i = 0; i < byteArray.length; i++) { arrByte[i] = (byte) pis.read(); System.out.println((char) arrByte[i]); } pis.reset(); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:SimpleAnnotationsWithAnotherPDF.java
public static void main(String[] args) { Document document1 = new Document(PageSize.A4, 10, 10, 10, 10); try {/*w ww. j a v a 2 s . c om*/ PdfWriter writer1 = PdfWriter.getInstance(document1, new FileOutputStream("SimpleAnnotationsWithAnotherPDF.pdf")); writer1.setPdfVersion(PdfWriter.VERSION_1_5); document1.open(); Annotation a = new Annotation(100f, 400f, 200f, 500f, "SimpleAnnotations1.pdf", 2); document1.add(a); } catch (Exception de) { de.printStackTrace(); } document1.close(); }
From source file:Main.java
public static void main(String[] args) { try {// ww w .ja v a 2 s. c o m String[] cmdArray = new String[2]; // the program to open cmdArray[0] = "notepad.exe"; // txt file to open with notepad cmdArray[1] = "data.txt"; String[] envArray = new String[2]; envArray[0] = ""; envArray[1] = ""; Runtime runTime = Runtime.getRuntime(); Process process = runTime.exec(cmdArray, envArray); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:Main.java
public static void main(String[] args) { byte[] arrByte = new byte[1024]; byte[] byteArray = new byte[] { 'j', 'a', 'v', 'a', '2', 's', '.', 'c', 'o', 'm' }; try {//from www. ja v a 2s.c o m InputStream is = new ByteArrayInputStream(byteArray); PushbackInputStream pis = new PushbackInputStream(is); System.out.println(pis.available()); for (int i = 0; i < byteArray.length; i++) { arrByte[i] = (byte) pis.read(); System.out.println((char) arrByte[i]); } } catch (Exception ex) { ex.printStackTrace(); } }
From source file:FixedFontWidthPDF.java
public static void main(String[] args) { Document document = new Document(PageSize.A4, 50, 50, 50, 50); try {/*from ww w. ja va 2s .c om*/ PdfWriter.getInstance(document, new FileOutputStream("FixedFontWidthPDF.pdf")); document.open(); BaseFont bf = BaseFont.createFont("Helvetica", "winansi", false, false, null, null); int widths[] = bf.getWidths(); for (int k = 0; k < widths.length; ++k) { if (widths[k] != 0) widths[k] = 1000; } bf.setForceWidthsOutput(true); document.add(new Paragraph("Helvetica with fixed width.", new Font(bf))); } catch (Exception de) { de.printStackTrace(); } document.close(); }
From source file:Main.java
public static void main(String args[]) { try {/*from www. j a v a2s .c o m*/ int port = 80; DatagramSocket ds = new DatagramSocket(port); byte buffer[] = new byte[BUFSIZE]; while (true) { DatagramPacket dp = new DatagramPacket(buffer, buffer.length); dp.setSocketAddress(InetSocketAddress.createUnresolved("google.com", 8080)); } } catch (Exception e) { e.printStackTrace(); } }
From source file:occi.libvirt.StartClass.java
public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("resources/conf/beans.xml"); BeanFactory factory = context;// ww w. j av a 2 s. c o m Injection test = (Injection) factory.getBean("Injection"); try { occiApi.main(null); } catch (Exception e) { e.printStackTrace(); } }
From source file:BarcodesPostnet.java
public static void main(String[] args) { Document document = new Document(PageSize.A4, 50, 50, 50, 50); try {// www. j av a 2s.c om PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("BarcodesPostnet.pdf")); document.open(); PdfContentByte cb = writer.getDirectContent(); BarcodePostnet codePost = new BarcodePostnet(); codePost.setCode("123451234"); Image imagePost = codePost.createImageWithBarcode(cb, null, null); document.add(new Phrase(new Chunk(imagePost, 0, 0))); } catch (Exception de) { de.printStackTrace(); } document.close(); }
From source file:Main.java
public static void main(String args[]) { try {/*from w w w . j a v a 2 s .c om*/ int port = 80; DatagramSocket ds = new DatagramSocket(port); while (true) { byte buffer[] = new byte[BUFSIZE]; DatagramPacket dp = new DatagramPacket(buffer, buffer.length); ds.receive(dp); String str = new String(dp.getData()); System.out.println(str); } } catch (Exception e) { e.printStackTrace(); } }
From source file:Barcodes128.java
public static void main(String[] args) { Document document = new Document(PageSize.A4, 50, 50, 50, 50); try {/* ww w . j a v a 2 s . c om*/ PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("Barcodes128.pdf")); document.open(); PdfContentByte cb = writer.getDirectContent(); Barcode128 code128 = new Barcode128(); code128.setCode("www.java2s.com"); Image image128 = code128.createImageWithBarcode(cb, null, null); document.add(new Phrase(new Chunk(image128, 0, 0))); } catch (Exception de) { de.printStackTrace(); } document.close(); }