List of usage examples for java.io IOException getMessage
public String getMessage()
From source file:CreatingAnchorInPDF.java
public static void main(String[] args) { Document document = new Document(); try {//from w w w . j av a 2 s .c o m PdfWriter pdf = PdfWriter.getInstance(document, new FileOutputStream("CreatingAnchorInPDF.pdf")); document.open(); document.add(new Paragraph("Some text")); Anchor pdfRef = new Anchor("http://www.java2s.com"); pdfRef.setReference("www.java2s.com"); Anchor rtfRef = new Anchor("Link for a web page."); rtfRef.setReference("www.java2s.com/aFileOnWebsite.htm"); document.add(pdfRef); document.add(Chunk.NEWLINE); document.add(rtfRef); } catch (DocumentException de) { System.err.println(de.getMessage()); } catch (IOException ioe) { System.err.println(ioe.getMessage()); } document.close(); }
From source file:CreatingHyperLinkForHTML.java
public static void main(String[] args) { Document document = new Document(); try {// ww w. j ava 2 s . c om HtmlWriter html = HtmlWriter.getInstance(document, new FileOutputStream("CreatingHyperLinkForHTML.html")); document.open(); document.add(new Paragraph("Some text")); Anchor pdfRef = new Anchor("http://www.java2s.com"); pdfRef.setReference("http://www.java2s.com"); Anchor rtfRef = new Anchor("a File"); rtfRef.setReference("./aFile.htm"); document.add(pdfRef); document.add(Chunk.NEWLINE); document.add(rtfRef); } catch (DocumentException de) { System.err.println(de.getMessage()); } catch (IOException ioe) { System.err.println(ioe.getMessage()); } document.close(); }
From source file:PauseWritingAndResumeWritingPDF.java
public static void main(String[] args) { Document document = new Document(); try {//from ww w . j av a2 s .co m PdfWriter pdf = PdfWriter.getInstance(document, new FileOutputStream("PauseWritingAndResumeWritingPDF.pdf")); document.open(); document.add(new Paragraph("Some text")); Anchor pdfRef = new Anchor("a link"); pdfRef.setReference("http://www.java2s.com"); pdf.pause(); document.add(pdfRef); document.add(Chunk.NEWLINE); document.add(pdfRef); document.add(Chunk.NEWLINE); pdf.resume(); } catch (DocumentException de) { System.err.println(de.getMessage()); } catch (IOException ioe) { System.err.println(ioe.getMessage()); } document.close(); }
From source file:foldersync.FolderSync.java
/** * @param args the command line arguments *///from w ww. j a v a 2 s. c om public static void main(String[] args) { // TODO code application logic here //JSONParser parser = new JSONParser(); try { Options options = new Options(args[0]); List<HashMap> watchList = options.watchesList(); while (true) { for (HashMap watch : watchList) { // System.out.println(watch); Sync sync = new Sync((String) watch.get("sourceDir"), (String) watch.get("destDir"), (List) watch.get("watch"), (List) watch.get("dontwatch")); sync.syncFolders(); } Thread.sleep(100); } } catch (IOException e) { System.out.println(e.getMessage()); e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } }
From source file:SettingPageSize11X17A9A10ARCHA.java
public static void main(String[] args) { Document document = new Document(); try {// w ww . ja va2 s . com PdfWriter.getInstance(document, new FileOutputStream("SettingPageSize11X17A9A10ARCHA.pdf")); document.open(); document.add(new Paragraph("First Page.")); document.setPageSize(PageSize._11X17); document.newPage(); document.add(new Paragraph("This PageSize is _11X17.")); document.setPageSize(PageSize.A9); document.newPage(); document.add(new Paragraph("This PageSize is A9.")); document.setPageSize(PageSize.A10); document.newPage(); document.add(new Paragraph("This PageSize is A10.")); document.setPageSize(PageSize.ARCH_A); document.newPage(); document.add(new Paragraph("This PageSize is ARCH_A.")); } catch (DocumentException de) { System.err.println(de.getMessage()); } catch (IOException ioe) { System.err.println(ioe.getMessage()); } document.close(); }
From source file:com.dhenton9000.json.JacksonFromStringDemo.java
public static void main(String[] args) { JacksonFromStringDemo j = new JacksonFromStringDemo(); try {/*w w w . ja v a2s .c om*/ j.demoReadFromString(); } catch (IOException ex) { LOG.error("main " + ex.getMessage()); } }
From source file:FileCopy.java
public static void main(String[] args) { try {//from w w w . j a v a2 s.co m copy("fromFile.txt", "toFile.txt"); } catch (IOException e) { System.err.println(e.getMessage()); } }
From source file:ElementAlignJustifiedBOTTOMLEFTPDF.java
public static void main(String[] args) { Document document = new Document(PageSize.A5, 36, 72, 108, 180); try {/*from w ww . j a v a 2s . com*/ PdfWriter.getInstance(document, new FileOutputStream("ElementAlignJustifiedBOTTOMLEFTPDF.pdf")); document.open(); Paragraph paragraph = new Paragraph(); paragraph.setAlignment(Element.ALIGN_JUSTIFIED); for (int i = 0; i < 60; i++) { paragraph.add("www.java2s.com has demo for Java, JavaScript, PDF."); } document.add(paragraph); paragraph = new Paragraph(); paragraph.setAlignment(Element.ALIGN_BOTTOM); for (int i = 0; i < 60; i++) { paragraph.add("www.java2s.com has demo for PDF (ALIGN_BOTTOM)."); } document.add(paragraph); paragraph = new Paragraph(); paragraph.setAlignment(Element.ALIGN_LEFT); for (int i = 0; i < 60; i++) { paragraph.add("www.java2s.com has demo for PDF (ALIGN_LEFT)."); } document.add(paragraph); document.setMargins(180, 108, 72, 36); document.add(new Paragraph("Now we change the margins. You will see the effect on the next page.")); } catch (DocumentException de) { System.err.println(de.getMessage()); } catch (IOException ioe) { System.err.println(ioe.getMessage()); } document.close(); }
From source file:com.discursive.jccook.httpclient.GetExample.java
public static void main(String[] args) { HttpClient client = new HttpClient(); String url = "http://www.discursive.com/jccook/"; HttpMethod method = new GetMethod(url); try {/*from w ww . jav a 2s. com*/ client.executeMethod(method); String response = method.getResponseBodyAsString(); System.out.println(response); } catch (HttpException he) { System.out.println("HTTP Problem: " + he.getMessage()); } catch (IOException ioe) { System.out.println("IO Exeception: " + ioe.getMessage()); } finally { method.releaseConnection(); method.recycle(); } }
From source file:Example3.java
public static void main(String[] args) { BeanContextSupport context = new BeanContextSupport(); System.out.println("Number of children nested into the context: " + context.size()); BeanContextChildSupport child = null; try {//from w w w . ja v a2 s .co m child = (BeanContextChildSupport) context .instantiateChild("java.beans.beancontext.BeanContextChildSupport"); } catch (IOException e) { System.out.println("IOException occurred: " + e.getMessage()); } catch (ClassNotFoundException e) { System.out.println("Class not found: " + e.getMessage()); } System.out.println("Number of children nested into the context: " + context.size()); }