1 31 package org.pdfbox.examples; 32 33 import java.io.IOException ; 34 import java.io.InputStream ; 35 import java.io.OutputStream ; 36 37 import org.pdfbox.cos.COSDocument; 38 39 import org.pdfbox.pdmodel.PDDocument; 40 41 import org.pdfbox.pdfwriter.COSWriter; 42 43 49 public abstract class AbstractExample 50 { 51 58 public void close( InputStream stream ) throws IOException 59 { 60 if( stream != null ) 61 { 62 stream.close(); 63 } 64 } 65 66 73 public void close( OutputStream stream ) throws IOException 74 { 75 if( stream != null ) 76 { 77 stream.close(); 78 } 79 } 80 81 88 public void close( COSDocument doc ) throws IOException 89 { 90 if( doc != null ) 91 { 92 doc.close(); 93 } 94 } 95 96 103 public void close( PDDocument doc ) throws IOException 104 { 105 if( doc != null ) 106 { 107 doc.close(); 108 } 109 } 110 111 118 public static void close( COSWriter writer ) throws IOException 119 { 120 if( writer != null ) 121 { 122 writer.close(); 123 } 124 } 125 } | Popular Tags |