poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiwiwi...@apache.org
Subject svn commit: r1751106 - in /poi/trunk/src/ooxml/java/org/apache/poi: POIXMLTextExtractor.java dev/OOXMLLister.java
Date Sat, 02 Jul 2016 23:08:07 GMT
Author: kiwiwings
Date: Sat Jul  2 23:08:07 2016
New Revision: 1751106

URL: http://svn.apache.org/viewvc?rev=1751106&view=rev
Log:
javadocs fixes (jdk8)

Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java
    poi/trunk/src/ooxml/java/org/apache/poi/dev/OOXMLLister.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java?rev=1751106&r1=1751105&r2=1751106&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java Sat Jul  2 23:08:07 2016
@@ -31,6 +31,8 @@ public abstract class POIXMLTextExtracto
 
 	/**
 	 * Creates a new text extractor for the given document
+	 * 
+	 * @param document the document to extract from
 	 */
 	public POIXMLTextExtractor(POIXMLDocument document) {
 		_document = document;

Modified: poi/trunk/src/ooxml/java/org/apache/poi/dev/OOXMLLister.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/dev/OOXMLLister.java?rev=1751106&r1=1751105&r2=1751106&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/dev/OOXMLLister.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/dev/OOXMLLister.java Sat Jul  2 23:08:07 2016
@@ -22,6 +22,7 @@ import java.io.InputStream;
 import java.io.PrintStream;
 import java.util.ArrayList;
 
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.openxml4j.opc.OPCPackage;
 import org.apache.poi.openxml4j.opc.PackageAccess;
 import org.apache.poi.openxml4j.opc.PackagePart;
@@ -47,28 +48,37 @@ public class OOXMLLister {
 	
 	/**
 	 * Figures out how big a given PackagePart is.
+	 * 
+	 * @param part the PackagePart
+	 * @return the size of the PackagePart
 	 */
 	public static long getSize(PackagePart part) throws IOException {
 		InputStream in = part.getInputStream();
-		byte[] b = new byte[8192];
-		long size = 0;
-		int read = 0;
-		
-		while(read > -1) {
-			read = in.read(b);
-			if(read > 0) {
-				size += read;
-			}
+		try {
+    		byte[] b = new byte[8192];
+    		long size = 0;
+    		int read = 0;
+    		
+    		while(read > -1) {
+    			read = in.read(b);
+    			if(read > 0) {
+    				size += read;
+    			}
+    		}
+    		
+    		return size;
+		} finally {
+		    in.close();
 		}
-		
-		return size;
 	}
 	
 	/**
 	 * Displays information on all the different
 	 *  parts of the OOXML file container.
+	 * @throws InvalidFormatException if the package relations are invalid
+	 * @throws IOException if the package can't be read 
 	 */
-	public void displayParts() throws Exception {
+	public void displayParts() throws InvalidFormatException, IOException {
 		ArrayList<PackagePart> parts = container.getParts();
 		for (PackagePart part : parts) {
 			disp.println(part.getPartName());
@@ -91,7 +101,7 @@ public class OOXMLLister {
 	 *  relationships between different parts
 	 *  of the OOXML file container.
 	 */
-	public void displayRelations() throws Exception {
+	public void displayRelations() {
 		PackageRelationshipCollection rels = 
 			container.getRelationships();
 		for (PackageRelationship rel : rels) {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message