You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2016/12/20 11:10:58 UTC

svn commit: r1775259 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/PDImageXObject.java

Author: tilman
Date: Tue Dec 20 11:10:58 2016
New Revision: 1775259

URL: http://svn.apache.org/viewvc?rev=1775259&view=rev
Log:
PDFBOX-2852: move constructors up per Java Code Conventions

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/PDImageXObject.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/PDImageXObject.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/PDImageXObject.java?rev=1775259&r1=1775258&r2=1775259&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/PDImageXObject.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/PDImageXObject.java Tue Dec 20 11:10:58 2016
@@ -70,19 +70,6 @@ public final class PDImageXObject extend
     private final PDResources resources;
 
     /**
-     * Creates a thumbnail Image XObject from the given COSBase and name.
-     * @param cosStream the COS stream
-     * @return an XObject
-     * @throws IOException if there is an error creating the XObject.
-     */
-    public static PDImageXObject createThumbnail(COSStream cosStream) throws IOException
-    {
-        // thumbnails are special, any non-null subtype is treated as being "Image"
-        PDStream pdStream = new PDStream(cosStream);
-        return new PDImageXObject(pdStream, null);
-    }
-
-    /**
      * Creates an Image XObject in the given document. This constructor is for internal PDFBox use
      * and is not for PDF generation. Users who want to create images should look at {@link #createFromFileByExtension(File, PDDocument)
      * }.
@@ -124,6 +111,41 @@ public final class PDImageXObject extend
     }
 
     /**
+     * Creates an Image XObject with the given stream as its contents and current color spaces. This
+     * constructor is for internal PDFBox use and is not for PDF generation. Users who want to
+     * create images should look at {@link #createFromFileByExtension(File, PDDocument) }.
+     *
+     * @param stream the XObject stream to read
+     * @param resources the current resources
+     * @throws java.io.IOException if there is an error creating the XObject.
+     */
+    public PDImageXObject(PDStream stream, PDResources resources) throws IOException
+    {
+        this(stream, resources, stream.createInputStream());
+    }
+    
+    // repairs parameters using decode result
+    private PDImageXObject(PDStream stream, PDResources resources, COSInputStream input)
+    {
+        super(repair(stream, input), COSName.IMAGE);
+        this.resources = resources;
+        this.colorSpace = input.getDecodeResult().getJPXColorSpace();
+    }
+
+    /**
+     * Creates a thumbnail Image XObject from the given COSBase and name.
+     * @param cosStream the COS stream
+     * @return an XObject
+     * @throws IOException if there is an error creating the XObject.
+     */
+    public static PDImageXObject createThumbnail(COSStream cosStream) throws IOException
+    {
+        // thumbnails are special, any non-null subtype is treated as being "Image"
+        PDStream pdStream = new PDStream(cosStream);
+        return new PDImageXObject(pdStream, null);
+    }
+
+    /**
      * Creates a COS stream from raw (encoded) data.
      */
     private static COSStream createRawStream(PDDocument document, InputStream rawInput)
@@ -147,20 +169,6 @@ public final class PDImageXObject extend
     }
 
     /**
-     * Creates an Image XObject with the given stream as its contents and current color spaces. This
-     * constructor is for internal PDFBox use and is not for PDF generation. Users who want to
-     * create images should look at {@link #createFromFileByExtension(File, PDDocument) }.
-     *
-     * @param stream the XObject stream to read
-     * @param resources the current resources
-     * @throws java.io.IOException if there is an error creating the XObject.
-     */
-    public PDImageXObject(PDStream stream, PDResources resources) throws IOException
-    {
-        this(stream, resources, stream.createInputStream());
-    }
-    
-    /**
      * Create a PDImageXObject from an image file, see {@link #createFromFileByExtension(File, PDDocument)} for
      * more details.
      *
@@ -278,14 +286,6 @@ public final class PDImageXObject extend
     }
 
     // repairs parameters using decode result
-    private PDImageXObject(PDStream stream, PDResources resources, COSInputStream input)
-    {
-        super(repair(stream, input), COSName.IMAGE);
-        this.resources = resources;
-        this.colorSpace = input.getDecodeResult().getJPXColorSpace();
-    }
-
-    // repairs parameters using decode result
     private static PDStream repair(PDStream stream, COSInputStream input)
     {
         stream.getCOSObject().addAll(input.getDecodeResult().getParameters());
@@ -699,7 +699,6 @@ public final class PDImageXObject extend
         else
         {
             LOG.warn("getSuffix() returns null, filters: " + filters);
-            // TODO more...
             return null;
         }
     }