pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject [03/14] pdfbox-jbig2 git commit: PDFBOX-4098: reformat the source code, introduce an eclipse formatter definition
Date Fri, 09 Feb 2018 17:06:18 GMT
http://git-wip-us.apache.org/repos/asf/pdfbox-jbig2/blob/30839c32/src/main/java/org/apache/pdfbox/jbig2/util/log/Logger.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/pdfbox/jbig2/util/log/Logger.java b/src/main/java/org/apache/pdfbox/jbig2/util/log/Logger.java
index 941ea61..88d5493 100644
--- a/src/main/java/org/apache/pdfbox/jbig2/util/log/Logger.java
+++ b/src/main/java/org/apache/pdfbox/jbig2/util/log/Logger.java
@@ -17,119 +17,118 @@
 
 package org.apache.pdfbox.jbig2.util.log;
 
-public interface Logger {
-
-
-  /**
-   * Log a message at the DEBUG level.
-   * 
-   * @param msg the message string to be logged
-   */
-  public void debug(String msg);
-
-  /**
-   * Log an exception ({@link Throwable}) at the DEBUG level with an accompanying message.
-   * 
-   * @param msg the message accompanying the exception.
-   * @param t the exception ({@link Throwable}) to log.
-   */
-  public void debug(String msg, Throwable t);
-
-  /**
-   * Log a message at the INFO level.
-   * 
-   * @param msg the message string to be logged
-   */
-  public void info(String msg);
-
-  /**
-   * Log an exception ({@link Throwable}) at the INFO level with an accompanying message.
-   * 
-   * @param msg the message accompanying the exception
-   * @param t the exception ({@link Throwable}) to log
-   */
-  public void info(String msg, Throwable t);
-
-  /**
-   * Log a message at the WARN level.
-   * 
-   * @param msg the message string to be logged
-   */
-  public void warn(String msg);
-
-  /**
-   * Log an exception ({@link Throwable}) at the WARN level with an accompanying message.
-   * 
-   * @param msg the message accompanying the exception
-   * @param t the exception ({@link Throwable}) to log
-   */
-  public void warn(String msg, Throwable t);
-
-  /**
-   * Log a message at the WARN level.
-   * 
-   * @param msg the message string to be logged
-   */
-  public void fatal(String msg);
-
-  /**
-   * Log an exception ({@link Throwable}) at the WARN level with an accompanying message.
-   * 
-   * @param msg the message accompanying the exception
-   * @param t the exception ({@link Throwable}) to log
-   */
-  public void fatal(String msg, Throwable t);
-
-  /**
-   * Log a message at the ERROR level.
-   * 
-   * @param msg the message string to be logged
-   */
-  public void error(String msg);
-
-  /**
-   * Log an exception ({@link Throwable}) at the ERROR level with an accompanying message.
-   * 
-   * @param msg the message accompanying the exception
-   * @param t the exception ({@link Throwable}) to log
-   */
-  public void error(String msg, Throwable t);
-
-  /**
-   * Is the logger instance enabled for the DEBUG level?
-   * 
-   * @return True if this Logger is enabled for the DEBUG level, false otherwise.
-   * 
-   */
-  public boolean isDebugEnabled();
-
-  /**
-   * Is the logger instance enabled for the INFO level?
-   * 
-   * @return True if this Logger is enabled for the INFO level, false otherwise.
-   */
-  public boolean isInfoEnabled();
-
-  /**
-   * Is the logger instance enabled for the WARN level?
-   * 
-   * @return True if this Logger is enabled for the WARN level, false otherwise.
-   */
-  public boolean isWarnEnabled();
-
-  /**
-   * Is the logger instance enabled for the FATAL level?
-   * 
-   * @return True if this Logger is enabled for the FATAL level, false otherwise.
-   */
-  public boolean isFatalEnabled();
-
-  /**
-   * Is the logger instance enabled for the ERROR level?
-   * 
-   * @return True if this Logger is enabled for the ERROR level, false otherwise.
-   */
-  public boolean isErrorEnabled();
-
+public interface Logger
+{
+
+    /**
+     * Log a message at the DEBUG level.
+     * 
+     * @param msg the message string to be logged
+     */
+    public void debug(String msg);
+
+    /**
+     * Log an exception ({@link Throwable}) at the DEBUG level with an accompanying message.
+     * 
+     * @param msg the message accompanying the exception.
+     * @param t the exception ({@link Throwable}) to log.
+     */
+    public void debug(String msg, Throwable t);
+
+    /**
+     * Log a message at the INFO level.
+     * 
+     * @param msg the message string to be logged
+     */
+    public void info(String msg);
+
+    /**
+     * Log an exception ({@link Throwable}) at the INFO level with an accompanying message.
+     * 
+     * @param msg the message accompanying the exception
+     * @param t the exception ({@link Throwable}) to log
+     */
+    public void info(String msg, Throwable t);
+
+    /**
+     * Log a message at the WARN level.
+     * 
+     * @param msg the message string to be logged
+     */
+    public void warn(String msg);
+
+    /**
+     * Log an exception ({@link Throwable}) at the WARN level with an accompanying message.
+     * 
+     * @param msg the message accompanying the exception
+     * @param t the exception ({@link Throwable}) to log
+     */
+    public void warn(String msg, Throwable t);
+
+    /**
+     * Log a message at the WARN level.
+     * 
+     * @param msg the message string to be logged
+     */
+    public void fatal(String msg);
+
+    /**
+     * Log an exception ({@link Throwable}) at the WARN level with an accompanying message.
+     * 
+     * @param msg the message accompanying the exception
+     * @param t the exception ({@link Throwable}) to log
+     */
+    public void fatal(String msg, Throwable t);
+
+    /**
+     * Log a message at the ERROR level.
+     * 
+     * @param msg the message string to be logged
+     */
+    public void error(String msg);
+
+    /**
+     * Log an exception ({@link Throwable}) at the ERROR level with an accompanying message.
+     * 
+     * @param msg the message accompanying the exception
+     * @param t the exception ({@link Throwable}) to log
+     */
+    public void error(String msg, Throwable t);
+
+    /**
+     * Is the logger instance enabled for the DEBUG level?
+     * 
+     * @return True if this Logger is enabled for the DEBUG level, false otherwise.
+     * 
+     */
+    public boolean isDebugEnabled();
+
+    /**
+     * Is the logger instance enabled for the INFO level?
+     * 
+     * @return True if this Logger is enabled for the INFO level, false otherwise.
+     */
+    public boolean isInfoEnabled();
+
+    /**
+     * Is the logger instance enabled for the WARN level?
+     * 
+     * @return True if this Logger is enabled for the WARN level, false otherwise.
+     */
+    public boolean isWarnEnabled();
+
+    /**
+     * Is the logger instance enabled for the FATAL level?
+     * 
+     * @return True if this Logger is enabled for the FATAL level, false otherwise.
+     */
+    public boolean isFatalEnabled();
+
+    /**
+     * Is the logger instance enabled for the ERROR level?
+     * 
+     * @return True if this Logger is enabled for the ERROR level, false otherwise.
+     */
+    public boolean isErrorEnabled();
 
 }

http://git-wip-us.apache.org/repos/asf/pdfbox-jbig2/blob/30839c32/src/main/java/org/apache/pdfbox/jbig2/util/log/LoggerBridge.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/pdfbox/jbig2/util/log/LoggerBridge.java b/src/main/java/org/apache/pdfbox/jbig2/util/log/LoggerBridge.java
index 6dd033c..034ac43 100644
--- a/src/main/java/org/apache/pdfbox/jbig2/util/log/LoggerBridge.java
+++ b/src/main/java/org/apache/pdfbox/jbig2/util/log/LoggerBridge.java
@@ -17,8 +17,9 @@
 
 package org.apache.pdfbox.jbig2.util.log;
 
-public interface LoggerBridge {
+public interface LoggerBridge
+{
 
-  Logger getLogger(Class<?> clazz);
+    Logger getLogger(Class<?> clazz);
 
 }

http://git-wip-us.apache.org/repos/asf/pdfbox-jbig2/blob/30839c32/src/main/java/org/apache/pdfbox/jbig2/util/log/LoggerFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/pdfbox/jbig2/util/log/LoggerFactory.java b/src/main/java/org/apache/pdfbox/jbig2/util/log/LoggerFactory.java
index 2eea946..be12015 100644
--- a/src/main/java/org/apache/pdfbox/jbig2/util/log/LoggerFactory.java
+++ b/src/main/java/org/apache/pdfbox/jbig2/util/log/LoggerFactory.java
@@ -24,32 +24,39 @@ import org.apache.pdfbox.jbig2.util.ServiceLookup;
 /**
  * Retrieves a {@link Logger} via registered {@link LoggerBridge} through META-INF/services lookup.
  */
-public class LoggerFactory {
-
-  private static LoggerBridge loggerBridge;
-
-  private static ClassLoader clsLoader;
-
-  public static Logger getLogger(Class<?> cls, ClassLoader clsLoader) {
-    if (null == loggerBridge) {
-      final ServiceLookup<LoggerBridge> serviceLookup = new ServiceLookup<LoggerBridge>();
-      final Iterator<LoggerBridge> loggerBridgeServices = serviceLookup.getServices(LoggerBridge.class, clsLoader);
-
-      if (!loggerBridgeServices.hasNext()) {
-        throw new IllegalStateException("No implementation of " + LoggerBridge.class
-            + " was avaliable using META-INF/services lookup");
-      }
-      loggerBridge = loggerBridgeServices.next();
+public class LoggerFactory
+{
+
+    private static LoggerBridge loggerBridge;
+
+    private static ClassLoader clsLoader;
+
+    public static Logger getLogger(Class<?> cls, ClassLoader clsLoader)
+    {
+        if (null == loggerBridge)
+        {
+            final ServiceLookup<LoggerBridge> serviceLookup = new ServiceLookup<LoggerBridge>();
+            final Iterator<LoggerBridge> loggerBridgeServices = serviceLookup
+                    .getServices(LoggerBridge.class, clsLoader);
+
+            if (!loggerBridgeServices.hasNext())
+            {
+                throw new IllegalStateException("No implementation of " + LoggerBridge.class
+                        + " was avaliable using META-INF/services lookup");
+            }
+            loggerBridge = loggerBridgeServices.next();
+        }
+        return loggerBridge.getLogger(cls);
     }
-    return loggerBridge.getLogger(cls);
-  }
 
-  public static Logger getLogger(Class<?> cls) {
-    return getLogger(cls, clsLoader != null ? clsLoader : LoggerBridge.class.getClassLoader());
-  }
+    public static Logger getLogger(Class<?> cls)
+    {
+        return getLogger(cls, clsLoader != null ? clsLoader : LoggerBridge.class.getClassLoader());
+    }
 
-  public static void setClassLoader(ClassLoader clsLoader) {
-    LoggerFactory.clsLoader = clsLoader;
-  }
+    public static void setClassLoader(ClassLoader clsLoader)
+    {
+        LoggerFactory.clsLoader = clsLoader;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/pdfbox-jbig2/blob/30839c32/src/test/java/org/apache/pdfbox/jbig2/BitmapTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/pdfbox/jbig2/BitmapTest.java b/src/test/java/org/apache/pdfbox/jbig2/BitmapTest.java
index 4be8be0..f649768 100644
--- a/src/test/java/org/apache/pdfbox/jbig2/BitmapTest.java
+++ b/src/test/java/org/apache/pdfbox/jbig2/BitmapTest.java
@@ -25,74 +25,83 @@ import junit.framework.Assert;
 
 import org.junit.Test;
 
-public class BitmapTest {
-
-  @Test
-  public void getPixelAndSetPixelTest() {
-    final Bitmap bitmap = new Bitmap(37, 49);
-    assertEquals(0, bitmap.getPixel(3, 19));
-    
-    bitmap.setPixel(3, 19, (byte) 1);
-
-    assertEquals(1, bitmap.getPixel(3, 19));
-  }
-
-  @Test
-  public void getByteAndSetByteTest() {
-    Bitmap bitmap = new Bitmap(16, 16);
-
-    byte value = (byte) 4;
-    bitmap.setByte(0, value);
-    bitmap.setByte(31, value);
-
-    assertEquals(value, bitmap.getByte(0));
-    assertEquals(value, bitmap.getByte(31));
-  }
-
-  @Test(expected = IndexOutOfBoundsException.class)
-  public void getByteThrowsExceptionTest() {
-    Bitmap bitmap = new Bitmap(16, 16);
-    bitmap.getByte(32);
-  }
-
-  @Test(expected = IndexOutOfBoundsException.class)
-  public void setByteThrowsExceptionTest() {
-    Bitmap bitmap = new Bitmap(16, 16);
-    bitmap.setByte(32, (byte) 0);
-  }
-
-  @Test
-  public void getByteAsIntegerTest() {
-    Bitmap bitmap = new Bitmap(16, 16);
-
-    byte byteValue = (byte) 4;
-    int integerValue = byteValue;
-    bitmap.setByte(0, byteValue);
-    bitmap.setByte(31, byteValue);
-
-    Assert.assertEquals(integerValue, bitmap.getByteAsInteger(0));
-    Assert.assertEquals(integerValue, bitmap.getByteAsInteger(31));
-
-  }
-
-  @Test(expected = IndexOutOfBoundsException.class)
-  public void getByteAsIntegerThrowsExceptionTest() {
-    Bitmap bitmap = new Bitmap(16, 16);
-    bitmap.getByte(32);
-  }
-
-  @Test
-  public void getHeightTest() {
-    int height = 16;
-    Bitmap bitmap = new Bitmap(1, height);
-    Assert.assertEquals(height, bitmap.getHeight());
-  }
-
-  @Test
-  public void getWidthTest() {
-    int width = 16;
-    Bitmap bitmap = new Bitmap(width, 1);
-    Assert.assertEquals(width, bitmap.getWidth());
-  }
+public class BitmapTest
+{
+
+    @Test
+    public void getPixelAndSetPixelTest()
+    {
+        final Bitmap bitmap = new Bitmap(37, 49);
+        assertEquals(0, bitmap.getPixel(3, 19));
+
+        bitmap.setPixel(3, 19, (byte) 1);
+
+        assertEquals(1, bitmap.getPixel(3, 19));
+    }
+
+    @Test
+    public void getByteAndSetByteTest()
+    {
+        Bitmap bitmap = new Bitmap(16, 16);
+
+        byte value = (byte) 4;
+        bitmap.setByte(0, value);
+        bitmap.setByte(31, value);
+
+        assertEquals(value, bitmap.getByte(0));
+        assertEquals(value, bitmap.getByte(31));
+    }
+
+    @Test(expected = IndexOutOfBoundsException.class)
+    public void getByteThrowsExceptionTest()
+    {
+        Bitmap bitmap = new Bitmap(16, 16);
+        bitmap.getByte(32);
+    }
+
+    @Test(expected = IndexOutOfBoundsException.class)
+    public void setByteThrowsExceptionTest()
+    {
+        Bitmap bitmap = new Bitmap(16, 16);
+        bitmap.setByte(32, (byte) 0);
+    }
+
+    @Test
+    public void getByteAsIntegerTest()
+    {
+        Bitmap bitmap = new Bitmap(16, 16);
+
+        byte byteValue = (byte) 4;
+        int integerValue = byteValue;
+        bitmap.setByte(0, byteValue);
+        bitmap.setByte(31, byteValue);
+
+        Assert.assertEquals(integerValue, bitmap.getByteAsInteger(0));
+        Assert.assertEquals(integerValue, bitmap.getByteAsInteger(31));
+
+    }
+
+    @Test(expected = IndexOutOfBoundsException.class)
+    public void getByteAsIntegerThrowsExceptionTest()
+    {
+        Bitmap bitmap = new Bitmap(16, 16);
+        bitmap.getByte(32);
+    }
+
+    @Test
+    public void getHeightTest()
+    {
+        int height = 16;
+        Bitmap bitmap = new Bitmap(1, height);
+        Assert.assertEquals(height, bitmap.getHeight());
+    }
+
+    @Test
+    public void getWidthTest()
+    {
+        int width = 16;
+        Bitmap bitmap = new Bitmap(width, 1);
+        Assert.assertEquals(width, bitmap.getWidth());
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/pdfbox-jbig2/blob/30839c32/src/test/java/org/apache/pdfbox/jbig2/ChecksumCalculator.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/pdfbox/jbig2/ChecksumCalculator.java b/src/test/java/org/apache/pdfbox/jbig2/ChecksumCalculator.java
index debc7b9..1ebc219 100644
--- a/src/test/java/org/apache/pdfbox/jbig2/ChecksumCalculator.java
+++ b/src/test/java/org/apache/pdfbox/jbig2/ChecksumCalculator.java
@@ -33,28 +33,32 @@ import org.junit.Ignore;
 import org.junit.Test;
 
 @Ignore
-public class ChecksumCalculator {
-
-  @Ignore
-  @Test
-  public void computeChecksum() throws NoSuchAlgorithmException, IOException, JBIG2Exception {
-    String filepath = "/images/sampledata_page3.jb2";
-    int pageNumber = 1;
-
-    InputStream is = getClass().getResourceAsStream(filepath);
-    DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
-    ImageInputStream iis = disf.getInputStream(is);
-    JBIG2Document doc = new JBIG2Document(iis);
-    Bitmap bitmap = doc.getPage(pageNumber).getBitmap();
-
-    byte[] md5 = md5(bitmap);
-    for (byte b : md5) {
-      System.out.print(b);
+public class ChecksumCalculator
+{
+
+    @Ignore
+    @Test
+    public void computeChecksum() throws NoSuchAlgorithmException, IOException, JBIG2Exception
+    {
+        String filepath = "/images/sampledata_page3.jb2";
+        int pageNumber = 1;
+
+        InputStream is = getClass().getResourceAsStream(filepath);
+        DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
+        ImageInputStream iis = disf.getInputStream(is);
+        JBIG2Document doc = new JBIG2Document(iis);
+        Bitmap bitmap = doc.getPage(pageNumber).getBitmap();
+
+        byte[] md5 = md5(bitmap);
+        for (byte b : md5)
+        {
+            System.out.print(b);
+        }
+        System.out.println(Arrays.toString(md5));
     }
-    System.out.println(Arrays.toString(md5));
-  }
 
-  public static byte[] md5(Bitmap b) throws NoSuchAlgorithmException {
-    return MessageDigest.getInstance("MD5").digest(b.getByteArray());
-  }
+    public static byte[] md5(Bitmap b) throws NoSuchAlgorithmException
+    {
+        return MessageDigest.getInstance("MD5").digest(b.getByteArray());
+    }
 }

http://git-wip-us.apache.org/repos/asf/pdfbox-jbig2/blob/30839c32/src/test/java/org/apache/pdfbox/jbig2/ChecksumTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/pdfbox/jbig2/ChecksumTest.java b/src/test/java/org/apache/pdfbox/jbig2/ChecksumTest.java
index 77b78bd..82776fc 100644
--- a/src/test/java/org/apache/pdfbox/jbig2/ChecksumTest.java
+++ b/src/test/java/org/apache/pdfbox/jbig2/ChecksumTest.java
@@ -39,141 +39,115 @@ import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
 
 @RunWith(Parameterized.class)
-public class ChecksumTest {
+public class ChecksumTest
+{
 
-  @Parameters
-  public static Collection<Object[]> data() {
-    return Arrays.asList(new Object[][]{
-        {
-            "target/images/042_1.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
-        }, {
-            "target/images/042_2.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
-        }, {
-            "target/images/042_3.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
-        }, {
-            "target/images/042_4.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
-        }, {
-            "target/images/042_5.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
-        }, {
-            "target/images/042_6.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
-        }, {
-            "target/images/042_7.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
-        }, {
-            "target/images/042_8.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
-        }, {
-            "target/images/042_9.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
-        }, {
-            "target/images/042_10.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
-        }, {
-            "target/images/042_11.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
-        }, {
-            "target/images/042_12.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
-        },
-        // { "/images/042_13.jb2",
-        // "69-26-6629-1793-107941058147-58-79-37-31-79" },
-        // { "/images/042_14.jb2",
-        // "69-26-6629-1793-107941058147-58-79-37-31-79" },
-        {
-            "target/images/042_15.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
-        }, {
-            "target/images/042_16.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
-        }, {
-            "target/images/042_17.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
-        }, {
-            "target/images/042_18.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
-        }, {
-            "target/images/042_19.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
-        }, {
-            "target/images/042_20.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
-        }, {
-            "target/images/042_21.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
-        }, {
-            "target/images/042_22.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
-        }, {
-            "target/images/042_23.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
-        }, {
-            "target/images/042_24.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
-        }, {
-            "target/images/042_25.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
-        }, {
-            "target/images/amb_1.jb2", "58311272494-318210035-125100-344625-126-79"
-        }, {
-            "target/images/amb_2.jb2", "58311272494-318210035-125100-344625-126-79"
-        }, {
-            "src/test/resources/images/002.jb2", "-12713-4587-92-651657111-57121-1582564895"
-        }, {
-            "src/test/resources/images/003.jb2", "-37-108-89-33-78-5019-966-96-124-9675-1-108-24"
-        }, {
-            "target/images/004.jb2", "-10709436-24-59-48-217114-37-85-3126-24"
-        }, {
-            "src/test/resources/images/005.jb2", "712610586-1224021396100112-102-77-1177851"
-        }, {
-            "src/test/resources/images/006.jb2", "-8719-116-83-83-35-3425-64-528667602154-25"
-        }, {
-            "target/images/007.jb2", "6171-125-109-20-128-71925295955793-127-41-122"
-        }, {
-            "target/images/sampledata_page1.jb2", "104-68-555325117-4757-48527676-9775-8432"
-        }, {
-            "target/images/sampledata_page2.jb2", "104-68-555325117-4757-48527676-9775-8432"
-        }, {
-            "target/images/sampledata_page3.jb2", "-7825-56-41-30-19-719536-3678580-61-2586"
-        }, {
-            "src/test/resources/images/20123110001.jb2", "60-96-101-2458-3335024-5468-5-11068-78-80"
-        }, {
-            "src/test/resources/images/20123110002.jb2", "-28-921048181-117-48-96126-110-9-2865611113"
-        }, {
-            "src/test/resources/images/20123110003.jb2", "-3942-239351-28-56-729169-5839122-439231"
-        }, {
-            "src/test/resources/images/20123110004.jb2", "-49-101-28-20-57-4-24-17-9352104-106-118-122-122"
-        }, {
-            "src/test/resources/images/20123110005.jb2", "-48221261779-94-838820-127-114110-2-88-80-106"
-        }, {
-            "src/test/resources/images/20123110006.jb2", "81-11870-63-30124-1614-45838-53-123-41639"
-        }, {
-            "src/test/resources/images/20123110007.jb2", "12183-49124728346-29-124-9-10775-63-44116103"
-        }, {
-            "src/test/resources/images/20123110008.jb2", "15-74-49-45958458-67-2545-96-119-122-60100-35"
-        }, {
-            "src/test/resources/images/20123110009.jb2", "36115-114-28-123-3-70-87-113-4197-8512396113-65"
-        }, {
-            "src/test/resources/images/20123110010.jb2", "-109-1069-61-1576-67-43122406037-75-1091115"
-        }
-    });
-  }
+    @Parameters
+    public static Collection<Object[]> data()
+    {
+        return Arrays.asList(new Object[][] {
+                { "target/images/042_1.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79" },
+                { "target/images/042_2.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79" },
+                { "target/images/042_3.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79" },
+                { "target/images/042_4.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79" },
+                { "target/images/042_5.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79" },
+                { "target/images/042_6.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79" },
+                { "target/images/042_7.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79" },
+                { "target/images/042_8.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79" },
+                { "target/images/042_9.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79" },
+                { "target/images/042_10.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79" },
+                { "target/images/042_11.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79" },
+                { "target/images/042_12.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79" },
+                // { "/images/042_13.jb2",
+                // "69-26-6629-1793-107941058147-58-79-37-31-79" },
+                // { "/images/042_14.jb2",
+                // "69-26-6629-1793-107941058147-58-79-37-31-79" },
+                { "target/images/042_15.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79" },
+                { "target/images/042_16.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79" },
+                { "target/images/042_17.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79" },
+                { "target/images/042_18.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79" },
+                { "target/images/042_19.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79" },
+                { "target/images/042_20.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79" },
+                { "target/images/042_21.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79" },
+                { "target/images/042_22.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79" },
+                { "target/images/042_23.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79" },
+                { "target/images/042_24.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79" },
+                { "target/images/042_25.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79" },
+                { "target/images/amb_1.jb2", "58311272494-318210035-125100-344625-126-79" },
+                { "target/images/amb_2.jb2", "58311272494-318210035-125100-344625-126-79" },
+                { "src/test/resources/images/002.jb2",
+                        "-12713-4587-92-651657111-57121-1582564895" },
+                { "src/test/resources/images/003.jb2",
+                        "-37-108-89-33-78-5019-966-96-124-9675-1-108-24" },
+                { "target/images/004.jb2", "-10709436-24-59-48-217114-37-85-3126-24" },
+                { "src/test/resources/images/005.jb2",
+                        "712610586-1224021396100112-102-77-1177851" },
+                { "src/test/resources/images/006.jb2",
+                        "-8719-116-83-83-35-3425-64-528667602154-25" },
+                { "target/images/007.jb2", "6171-125-109-20-128-71925295955793-127-41-122" },
+                { "target/images/sampledata_page1.jb2",
+                        "104-68-555325117-4757-48527676-9775-8432" },
+                { "target/images/sampledata_page2.jb2",
+                        "104-68-555325117-4757-48527676-9775-8432" },
+                { "target/images/sampledata_page3.jb2",
+                        "-7825-56-41-30-19-719536-3678580-61-2586" },
+                { "src/test/resources/images/20123110001.jb2",
+                        "60-96-101-2458-3335024-5468-5-11068-78-80" },
+                { "src/test/resources/images/20123110002.jb2",
+                        "-28-921048181-117-48-96126-110-9-2865611113" },
+                { "src/test/resources/images/20123110003.jb2",
+                        "-3942-239351-28-56-729169-5839122-439231" },
+                { "src/test/resources/images/20123110004.jb2",
+                        "-49-101-28-20-57-4-24-17-9352104-106-118-122-122" },
+                { "src/test/resources/images/20123110005.jb2",
+                        "-48221261779-94-838820-127-114110-2-88-80-106" },
+                { "src/test/resources/images/20123110006.jb2",
+                        "81-11870-63-30124-1614-45838-53-123-41639" },
+                { "src/test/resources/images/20123110007.jb2",
+                        "12183-49124728346-29-124-9-10775-63-44116103" },
+                { "src/test/resources/images/20123110008.jb2",
+                        "15-74-49-45958458-67-2545-96-119-122-60100-35" },
+                { "src/test/resources/images/20123110009.jb2",
+                        "36115-114-28-123-3-70-87-113-4197-8512396113-65" },
+                { "src/test/resources/images/20123110010.jb2",
+                        "-109-1069-61-1576-67-43122406037-75-1091115" } });
+    }
 
-  private final String filepath;
-  private final String checksum;
+    private final String filepath;
+    private final String checksum;
 
-  public ChecksumTest(String filepath, String cksum) {
-    this.filepath = filepath;
-    this.checksum = cksum;
-  }
+    public ChecksumTest(String filepath, String cksum)
+    {
+        this.filepath = filepath;
+        this.checksum = cksum;
+    }
 
-  @Test
-  public void compareChecksum() throws Throwable {
-    int imageIndex = 1;
+    @Test
+    public void compareChecksum() throws Throwable
+    {
+        int imageIndex = 1;
 
-    final File inputFile = new File(filepath);
-    // skip test if input stream isn't available
-    assumeTrue(inputFile.exists());
+        final File inputFile = new File(filepath);
+        // skip test if input stream isn't available
+        assumeTrue(inputFile.exists());
 
-    final InputStream inputStream = new FileInputStream(inputFile);
+        final InputStream inputStream = new FileInputStream(inputFile);
 
-    DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
-    ImageInputStream iis = disf.getInputStream(inputStream);
+        DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
+        ImageInputStream iis = disf.getInputStream(inputStream);
 
-    JBIG2Document doc = new JBIG2Document(iis);
+        JBIG2Document doc = new JBIG2Document(iis);
 
-    Bitmap b = doc.getPage(imageIndex).getBitmap();
+        Bitmap b = doc.getPage(imageIndex).getBitmap();
 
-    byte[] digest = MessageDigest.getInstance("MD5").digest(b.getByteArray());
+        byte[] digest = MessageDigest.getInstance("MD5").digest(b.getByteArray());
 
-    StringBuilder stringBuilder = new StringBuilder();
-    for (byte toAppend : digest)
-    {
-        stringBuilder.append(toAppend);
-    }
+        StringBuilder stringBuilder = new StringBuilder();
+        for (byte toAppend : digest)
+        {
+            stringBuilder.append(toAppend);
+        }
 
-    Assert.assertEquals(checksum, stringBuilder.toString());
-  }
+        Assert.assertEquals(checksum, stringBuilder.toString());
+    }
 }

http://git-wip-us.apache.org/repos/asf/pdfbox-jbig2/blob/30839c32/src/test/java/org/apache/pdfbox/jbig2/GithubIssuesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/pdfbox/jbig2/GithubIssuesTest.java b/src/test/java/org/apache/pdfbox/jbig2/GithubIssuesTest.java
index abee340..b5464c5 100644
--- a/src/test/java/org/apache/pdfbox/jbig2/GithubIssuesTest.java
+++ b/src/test/java/org/apache/pdfbox/jbig2/GithubIssuesTest.java
@@ -32,39 +32,44 @@ import org.junit.Assert;
 import org.junit.Test;
 
 /**
- * Collection of tests for <a href="https://github.com/levigo/jbig2-imageio/issues">Github
- * issues</a>.
+ * Collection of tests for <a href="https://github.com/levigo/jbig2-imageio/issues">Github issues</a>.
  */
-public class GithubIssuesTest {
+public class GithubIssuesTest
+{
 
-  /**
-   * <a href="https://github.com/levigo/jbig2-imageio/issues/21">Github issue 21s</a>
-   */
-  @Test
-  public void issue21() throws Exception {
-    final byte[] md5Expected = new byte[]{
-        83, 74, -69, -60, -122, -99, 21, 126, -115, 13, 9, 107, -31, -109, 77, -119
-    };
+    /**
+     * <a href="https://github.com/levigo/jbig2-imageio/issues/21">Github issue 21s</a>
+     */
+    @Test
+    public void issue21() throws Exception
+    {
+        final byte[] md5Expected = new byte[] { 83, 74, -69, -60, -122, -99, 21, 126, -115, 13, 9,
+                107, -31, -109, 77, -119 };
 
-    final InputStream imageStream = getClass().getResourceAsStream("/org/apache/pdfbox/jbig2/github/21.jb2");
-    final InputStream globalsStream = getClass().getResourceAsStream("/org/apache/pdfbox/jbig2/github/21.glob");
-    final ImageInputStream globalsIIS = ImageIO.createImageInputStream(globalsStream);
-    final ImageInputStream imageIIS = ImageIO.createImageInputStream(imageStream);
+        final InputStream imageStream = getClass()
+                .getResourceAsStream("/org/apache/pdfbox/jbig2/github/21.jb2");
+        final InputStream globalsStream = getClass()
+                .getResourceAsStream("/org/apache/pdfbox/jbig2/github/21.glob");
+        final ImageInputStream globalsIIS = ImageIO.createImageInputStream(globalsStream);
+        final ImageInputStream imageIIS = ImageIO.createImageInputStream(imageStream);
 
-    byte[] md5Actual = null;
-    try {
-      final JBIG2Document doc = doc(imageIIS, globalsIIS);
-      final JBIG2Page page = doc.getPage(1);
-      final Bitmap bitmap = page.getBitmap();
-      md5Actual = md5(bitmap);
-    } finally {
-      Assert.assertArrayEquals(md5Expected, md5Actual);
+        byte[] md5Actual = null;
+        try
+        {
+            final JBIG2Document doc = doc(imageIIS, globalsIIS);
+            final JBIG2Page page = doc.getPage(1);
+            final Bitmap bitmap = page.getBitmap();
+            md5Actual = md5(bitmap);
+        }
+        finally
+        {
+            Assert.assertArrayEquals(md5Expected, md5Actual);
 
-      globalsIIS.close();
-      globalsStream.close();
-      imageIIS.close();
-      imageStream.close();
-    }
+            globalsIIS.close();
+            globalsStream.close();
+            imageIIS.close();
+            imageStream.close();
+        }
 
-  }
+    }
 }

http://git-wip-us.apache.org/repos/asf/pdfbox-jbig2/blob/30839c32/src/test/java/org/apache/pdfbox/jbig2/JBIG2DocumentFacade.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/pdfbox/jbig2/JBIG2DocumentFacade.java b/src/test/java/org/apache/pdfbox/jbig2/JBIG2DocumentFacade.java
index e38c09d..b72858b 100644
--- a/src/test/java/org/apache/pdfbox/jbig2/JBIG2DocumentFacade.java
+++ b/src/test/java/org/apache/pdfbox/jbig2/JBIG2DocumentFacade.java
@@ -27,27 +27,34 @@ import org.apache.pdfbox.jbig2.JBIG2Globals;
 import org.apache.pdfbox.jbig2.JBIG2Page;
 import org.apache.pdfbox.jbig2.err.JBIG2Exception;
 
-public class JBIG2DocumentFacade extends JBIG2Document {
-  
-  public static JBIG2Document doc(ImageInputStream doc, ImageInputStream globals) throws IOException {
-    final JBIG2Document globalsDoc = new JBIG2Document(globals);
-    return new JBIG2Document(doc, globalsDoc.getGlobalSegments());
-  }
-
-  public JBIG2DocumentFacade(ImageInputStream input) throws IOException {
-    super(input);
-  }
-
-  public JBIG2DocumentFacade(ImageInputStream input, JBIG2Globals globals) throws IOException {
-    super(input, globals);
-  }
-
-  public JBIG2Page getPage(int pageNumber) {
-    return super.getPage(pageNumber);
-  }
-
-  public Bitmap getPageBitmap(int pageNumber) throws JBIG2Exception, IOException {
-    return getPage(pageNumber).getBitmap();
-  }
+public class JBIG2DocumentFacade extends JBIG2Document
+{
+
+    public static JBIG2Document doc(ImageInputStream doc, ImageInputStream globals)
+            throws IOException
+    {
+        final JBIG2Document globalsDoc = new JBIG2Document(globals);
+        return new JBIG2Document(doc, globalsDoc.getGlobalSegments());
+    }
+
+    public JBIG2DocumentFacade(ImageInputStream input) throws IOException
+    {
+        super(input);
+    }
+
+    public JBIG2DocumentFacade(ImageInputStream input, JBIG2Globals globals) throws IOException
+    {
+        super(input, globals);
+    }
+
+    public JBIG2Page getPage(int pageNumber)
+    {
+        return super.getPage(pageNumber);
+    }
+
+    public Bitmap getPageBitmap(int pageNumber) throws JBIG2Exception, IOException
+    {
+        return getPage(pageNumber).getBitmap();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/pdfbox-jbig2/blob/30839c32/src/test/java/org/apache/pdfbox/jbig2/JBIG2ImageReaderDemo.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/pdfbox/jbig2/JBIG2ImageReaderDemo.java b/src/test/java/org/apache/pdfbox/jbig2/JBIG2ImageReaderDemo.java
index bb253cc..8e4965a 100644
--- a/src/test/java/org/apache/pdfbox/jbig2/JBIG2ImageReaderDemo.java
+++ b/src/test/java/org/apache/pdfbox/jbig2/JBIG2ImageReaderDemo.java
@@ -39,41 +39,46 @@ import org.apache.pdfbox.jbig2.image.Bitmaps;
 import org.apache.pdfbox.jbig2.image.FilterType;
 import org.apache.pdfbox.jbig2.io.DefaultInputStreamFactory;
 
-public class JBIG2ImageReaderDemo {
+public class JBIG2ImageReaderDemo
+{
 
-  private String filepath;
-  private int imageIndex;
+    private String filepath;
+    private int imageIndex;
 
-  public JBIG2ImageReaderDemo(String filepath, int imageIndex) {
-    this.filepath = filepath;
-    this.imageIndex = imageIndex;
-  }
+    public JBIG2ImageReaderDemo(String filepath, int imageIndex)
+    {
+        this.filepath = filepath;
+        this.imageIndex = imageIndex;
+    }
 
-  public void show() throws IOException, JBIG2Exception {
-    InputStream inputStream = new FileInputStream(new File(filepath));
-    DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
-    ImageInputStream imageInputStream = disf.getInputStream(inputStream);
+    public void show() throws IOException, JBIG2Exception
+    {
+        InputStream inputStream = new FileInputStream(new File(filepath));
+        DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
+        ImageInputStream imageInputStream = disf.getInputStream(inputStream);
 
-    JBIG2ImageReader imageReader = new JBIG2ImageReader(new JBIG2ImageReaderSpi());
+        JBIG2ImageReader imageReader = new JBIG2ImageReader(new JBIG2ImageReaderSpi());
 
-    imageReader.setInput(imageInputStream);
-    ImageReadParam param = new PreconfiguredImageReadParam(new Rectangle(100, 100, 500, 500));
+        imageReader.setInput(imageInputStream);
+        ImageReadParam param = new PreconfiguredImageReadParam(new Rectangle(100, 100, 500, 500));
 
-    long timeStamp = System.currentTimeMillis();
+        long timeStamp = System.currentTimeMillis();
 
-    final JBIG2Document doc = new JBIG2Document(imageInputStream);
-    final Bitmap bitmap = doc.getPage(imageIndex).getBitmap();
-    final BufferedImage bufferedImage = Bitmaps.asBufferedImage(bitmap, param, FilterType.Lanczos);
-    long duration = System.currentTimeMillis() - timeStamp;
-    System.out.println(filepath + " decoding took " + duration + " ms");
+        final JBIG2Document doc = new JBIG2Document(imageInputStream);
+        final Bitmap bitmap = doc.getPage(imageIndex).getBitmap();
+        final BufferedImage bufferedImage = Bitmaps.asBufferedImage(bitmap, param,
+                FilterType.Lanczos);
+        long duration = System.currentTimeMillis() - timeStamp;
+        System.out.println(filepath + " decoding took " + duration + " ms");
 
-    new TestImage(bufferedImage);
-  }
+        new TestImage(bufferedImage);
+    }
 
-  public static void main(String[] args) throws InterruptedException, InvocationTargetException, IOException,
-      JBIG2Exception {
-    URL imageUrl = JBIG2ImageReaderDemo.class.getResource("/images/042_1.jb2");
-    new JBIG2ImageReaderDemo(imageUrl.getPath(), 1).show();
-  }
+    public static void main(String[] args)
+            throws InterruptedException, InvocationTargetException, IOException, JBIG2Exception
+    {
+        URL imageUrl = JBIG2ImageReaderDemo.class.getResource("/images/042_1.jb2");
+        new JBIG2ImageReaderDemo(imageUrl.getPath(), 1).show();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/pdfbox-jbig2/blob/30839c32/src/test/java/org/apache/pdfbox/jbig2/JBIG2ImageReaderTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/pdfbox/jbig2/JBIG2ImageReaderTest.java b/src/test/java/org/apache/pdfbox/jbig2/JBIG2ImageReaderTest.java
index f4a087f..ef0ee69 100644
--- a/src/test/java/org/apache/pdfbox/jbig2/JBIG2ImageReaderTest.java
+++ b/src/test/java/org/apache/pdfbox/jbig2/JBIG2ImageReaderTest.java
@@ -39,127 +39,139 @@ import org.apache.pdfbox.jbig2.err.InvalidHeaderValueException;
 import org.apache.pdfbox.jbig2.io.DefaultInputStreamFactory;
 import org.junit.Test;
 
-public class JBIG2ImageReaderTest {
+public class JBIG2ImageReaderTest
+{
 
-  @Test
-  public void testGetDefaultReadParams() throws Exception {
-    ImageReader reader = new JBIG2ImageReader(new JBIG2ImageReaderSpi());
-    ImageReadParam param = reader.getDefaultReadParam();
-    Assert.assertNotNull(param);
+    @Test
+    public void testGetDefaultReadParams() throws Exception
+    {
+        ImageReader reader = new JBIG2ImageReader(new JBIG2ImageReaderSpi());
+        ImageReadParam param = reader.getDefaultReadParam();
+        Assert.assertNotNull(param);
 
-    Assert.assertNull(param.getSourceRegion());
-    Assert.assertNull(param.getSourceRenderSize());
+        Assert.assertNull(param.getSourceRegion());
+        Assert.assertNull(param.getSourceRenderSize());
 
-    Assert.assertEquals(1, param.getSourceXSubsampling());
-    Assert.assertEquals(1, param.getSourceYSubsampling());
-    Assert.assertEquals(0, param.getSubsamplingXOffset());
-    Assert.assertEquals(0, param.getSubsamplingYOffset());
-  }
+        Assert.assertEquals(1, param.getSourceXSubsampling());
+        Assert.assertEquals(1, param.getSourceYSubsampling());
+        Assert.assertEquals(0, param.getSubsamplingXOffset());
+        Assert.assertEquals(0, param.getSubsamplingYOffset());
+    }
 
-  @Test
-  public void testRead() throws IOException, InvalidHeaderValueException, IntegerMaxValueException {
+    @Test
+    public void testRead() throws IOException, InvalidHeaderValueException, IntegerMaxValueException
+    {
 
-    int imageIndex = 0;
+        int imageIndex = 0;
 
-    final File inputFile = new File("target/images/042_1.jb2");
-    // skip test if input stream isn't available
-    assumeTrue(inputFile.exists());
+        final File inputFile = new File("target/images/042_1.jb2");
+        // skip test if input stream isn't available
+        assumeTrue(inputFile.exists());
 
-    InputStream inputStream = new FileInputStream(inputFile);
+        InputStream inputStream = new FileInputStream(inputFile);
 
-    DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
-    ImageInputStream imageInputStream = disf.getInputStream(inputStream);
+        DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
+        ImageInputStream imageInputStream = disf.getInputStream(inputStream);
 
-    JBIG2ImageReader imageReader = new JBIG2ImageReader(new JBIG2ImageReaderSpi());
-    imageReader.setInput(imageInputStream);
+        JBIG2ImageReader imageReader = new JBIG2ImageReader(new JBIG2ImageReaderSpi());
+        imageReader.setInput(imageInputStream);
 
-    // long timeStamp = System.currentTimeMillis();
-    BufferedImage bufferedImage = imageReader.read(imageIndex, imageReader.getDefaultReadParam());
-    // long duration = System.currentTimeMillis() - timeStamp;
-    // System.out.println(filepath + " decoding took " + duration + " ms");
+        // long timeStamp = System.currentTimeMillis();
+        BufferedImage bufferedImage = imageReader.read(imageIndex,
+                imageReader.getDefaultReadParam());
+        // long duration = System.currentTimeMillis() - timeStamp;
+        // System.out.println(filepath + " decoding took " + duration + " ms");
 
-    Assert.assertNotNull(bufferedImage);
-  }
+        Assert.assertNotNull(bufferedImage);
+    }
 
-  @Test
-  public void testReadRaster() throws IOException, InvalidHeaderValueException, IntegerMaxValueException {
+    @Test
+    public void testReadRaster()
+            throws IOException, InvalidHeaderValueException, IntegerMaxValueException
+    {
 
-    int imageIndex = 0;
+        int imageIndex = 0;
 
-    final File inputFile = new File("target/images/042_1.jb2");
-    // skip test if input stream isn't available
-    assumeTrue(inputFile.exists());
+        final File inputFile = new File("target/images/042_1.jb2");
+        // skip test if input stream isn't available
+        assumeTrue(inputFile.exists());
 
-    InputStream inputStream = new FileInputStream(inputFile);
+        InputStream inputStream = new FileInputStream(inputFile);
 
-    DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
-    ImageInputStream imageInputStream = disf.getInputStream(inputStream);
+        DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
+        ImageInputStream imageInputStream = disf.getInputStream(inputStream);
 
-    JBIG2ImageReader imageReader = new JBIG2ImageReader(new JBIG2ImageReaderSpi());
-    imageReader.setInput(imageInputStream);
-    Raster raster = imageReader.readRaster(imageIndex, imageReader.getDefaultReadParam());
+        JBIG2ImageReader imageReader = new JBIG2ImageReader(new JBIG2ImageReaderSpi());
+        imageReader.setInput(imageInputStream);
+        Raster raster = imageReader.readRaster(imageIndex, imageReader.getDefaultReadParam());
 
-    Assert.assertNotNull(raster);
-  }
+        Assert.assertNotNull(raster);
+    }
 
-  @Test
-  public void testReadImageReadParamNull() throws IOException, InvalidHeaderValueException, IntegerMaxValueException {
+    @Test
+    public void testReadImageReadParamNull()
+            throws IOException, InvalidHeaderValueException, IntegerMaxValueException
+    {
 
-    int imageIndex = 0;
-    
-    final File inputFile = new File("target/images/042_1.jb2");
-    // skip test if input stream isn't available
-    assumeTrue(inputFile.exists());
+        int imageIndex = 0;
 
-    InputStream inputStream = new FileInputStream(inputFile);
+        final File inputFile = new File("target/images/042_1.jb2");
+        // skip test if input stream isn't available
+        assumeTrue(inputFile.exists());
 
-    DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
-    ImageInputStream imageInputStream = disf.getInputStream(inputStream);
-    JBIG2ImageReader imageReader = new JBIG2ImageReader(new JBIG2ImageReaderSpi());
-    imageReader.setInput(imageInputStream);
-    BufferedImage bufferedImage = imageReader.read(imageIndex, null);
+        InputStream inputStream = new FileInputStream(inputFile);
 
-    Assert.assertNotNull(bufferedImage);
-  }
+        DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
+        ImageInputStream imageInputStream = disf.getInputStream(inputStream);
+        JBIG2ImageReader imageReader = new JBIG2ImageReader(new JBIG2ImageReaderSpi());
+        imageReader.setInput(imageInputStream);
+        BufferedImage bufferedImage = imageReader.read(imageIndex, null);
 
-  @Test
-  public void testReadRasterImageReadParamNull() throws IOException, InvalidHeaderValueException,
-      IntegerMaxValueException {
+        Assert.assertNotNull(bufferedImage);
+    }
 
-    int imageIndex = 0;
-    
-    final File inputFile = new File("target/images/042_1.jb2");
-    // skip test if input stream isn't available
-    assumeTrue(inputFile.exists());
+    @Test
+    public void testReadRasterImageReadParamNull()
+            throws IOException, InvalidHeaderValueException, IntegerMaxValueException
+    {
 
-    InputStream inputStream = new FileInputStream(inputFile);
+        int imageIndex = 0;
 
-    DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
-    ImageInputStream imageInputStream = disf.getInputStream(inputStream);
-    JBIG2ImageReader imageReader = new JBIG2ImageReader(new JBIG2ImageReaderSpi());
-    imageReader.setInput(imageInputStream);
-    Raster raster = imageReader.readRaster(imageIndex, null);
+        final File inputFile = new File("target/images/042_1.jb2");
+        // skip test if input stream isn't available
+        assumeTrue(inputFile.exists());
 
-    Assert.assertNotNull(raster);
-  }
+        InputStream inputStream = new FileInputStream(inputFile);
 
-  @Test
-  public void testGetNumImages() throws IOException, InvalidHeaderValueException, IntegerMaxValueException {
-    String filepath = "/images/002.jb2";
+        DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
+        ImageInputStream imageInputStream = disf.getInputStream(inputStream);
+        JBIG2ImageReader imageReader = new JBIG2ImageReader(new JBIG2ImageReaderSpi());
+        imageReader.setInput(imageInputStream);
+        Raster raster = imageReader.readRaster(imageIndex, null);
 
-    InputStream inputStream = getClass().getResourceAsStream(filepath);
-    DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
-    ImageInputStream imageInputStream = disf.getInputStream(inputStream);
-    JBIG2ImageReader imageReader = new JBIG2ImageReader(new JBIG2ImageReaderSpi());
-    imageReader.setInput(imageInputStream);
-    int numImages = imageReader.getNumImages(true);
-    Assert.assertEquals(17, numImages);
-  }
+        Assert.assertNotNull(raster);
+    }
 
-  @Test
-  public void testCanReadRaster() throws IOException {
-    JBIG2ImageReader imageReader = new JBIG2ImageReader(new JBIG2ImageReaderSpi());
-    Assert.assertTrue(imageReader.canReadRaster());
-  }
+    @Test
+    public void testGetNumImages()
+            throws IOException, InvalidHeaderValueException, IntegerMaxValueException
+    {
+        String filepath = "/images/002.jb2";
+
+        InputStream inputStream = getClass().getResourceAsStream(filepath);
+        DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
+        ImageInputStream imageInputStream = disf.getInputStream(inputStream);
+        JBIG2ImageReader imageReader = new JBIG2ImageReader(new JBIG2ImageReaderSpi());
+        imageReader.setInput(imageInputStream);
+        int numImages = imageReader.getNumImages(true);
+        Assert.assertEquals(17, numImages);
+    }
+
+    @Test
+    public void testCanReadRaster() throws IOException
+    {
+        JBIG2ImageReader imageReader = new JBIG2ImageReader(new JBIG2ImageReaderSpi());
+        Assert.assertTrue(imageReader.canReadRaster());
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/pdfbox-jbig2/blob/30839c32/src/test/java/org/apache/pdfbox/jbig2/JBIG2PageTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/pdfbox/jbig2/JBIG2PageTest.java b/src/test/java/org/apache/pdfbox/jbig2/JBIG2PageTest.java
index 6c23b60..b682360 100644
--- a/src/test/java/org/apache/pdfbox/jbig2/JBIG2PageTest.java
+++ b/src/test/java/org/apache/pdfbox/jbig2/JBIG2PageTest.java
@@ -39,91 +39,99 @@ import org.apache.pdfbox.jbig2.io.DefaultInputStreamFactory;
 import org.junit.Ignore;
 import org.junit.Test;
 
-public class JBIG2PageTest {
+public class JBIG2PageTest
+{
 
-  // TESTS WITH TESTOUTPUT
-  // Ignore in build process
+    // TESTS WITH TESTOUTPUT
+    // Ignore in build process
 
-  @Ignore
-  @Test
-  public void composeDisplayTest() throws IOException, JBIG2Exception {
+    @Ignore
+    @Test
+    public void composeDisplayTest() throws IOException, JBIG2Exception
+    {
 
-    final File inputFile = new File("target/images/amb_1.jb2");
-    // skip test if input stream isn't available
-    assumeTrue(inputFile.exists());
+        final File inputFile = new File("target/images/amb_1.jb2");
+        // skip test if input stream isn't available
+        assumeTrue(inputFile.exists());
 
-    int pageNumber = 1;
+        int pageNumber = 1;
 
-    InputStream is = new FileInputStream(inputFile);
-    DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
-    ImageInputStream iis = disf.getInputStream(is);
-    JBIG2Document doc = new JBIG2Document(iis);
+        InputStream is = new FileInputStream(inputFile);
+        DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
+        ImageInputStream iis = disf.getInputStream(is);
+        JBIG2Document doc = new JBIG2Document(iis);
 
-    Bitmap pageBitmap = doc.getPage(pageNumber).getBitmap();
-    BufferedImage b = Bitmaps.asBufferedImage(pageBitmap, new JBIG2ReadParam(1, 1, 0, 0, new Rectangle(166, 333, 555,
-        444), null), FilterType.Gaussian);
-    new TestImage(b);
-  }
+        Bitmap pageBitmap = doc.getPage(pageNumber).getBitmap();
+        BufferedImage b = Bitmaps.asBufferedImage(pageBitmap,
+                new JBIG2ReadParam(1, 1, 0, 0, new Rectangle(166, 333, 555, 444), null),
+                FilterType.Gaussian);
+        new TestImage(b);
+    }
 
-  @Ignore
-  @Test
-  public void composeTestWithDurationCalc() throws IOException, JBIG2Exception {
-    int runs = 40;
-    long avg = 0;
+    @Ignore
+    @Test
+    public void composeTestWithDurationCalc() throws IOException, JBIG2Exception
+    {
+        int runs = 40;
+        long avg = 0;
 
-    final File inputFile = new File("target/images/042_8.jb2");
-    // skip test if input stream isn't available
-    assumeTrue(inputFile.exists());
+        final File inputFile = new File("target/images/042_8.jb2");
+        // skip test if input stream isn't available
+        assumeTrue(inputFile.exists());
 
-    int pageNumber = 1;
+        int pageNumber = 1;
 
-    InputStream is = new FileInputStream(inputFile);
-    DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
-    ImageInputStream iis = disf.getInputStream(is);
+        InputStream is = new FileInputStream(inputFile);
+        DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
+        ImageInputStream iis = disf.getInputStream(is);
 
-    for (int i = 0; i < runs; i++) {
+        for (int i = 0; i < runs; i++)
+        {
 
-      long time = System.currentTimeMillis();
-      JBIG2Document doc = new JBIG2Document(iis);
-      Bitmap pageBitmap = doc.getPage(pageNumber).getBitmap();
-      Bitmaps.asBufferedImage(pageBitmap);
-      long duration = System.currentTimeMillis() - time;
+            long time = System.currentTimeMillis();
+            JBIG2Document doc = new JBIG2Document(iis);
+            Bitmap pageBitmap = doc.getPage(pageNumber).getBitmap();
+            Bitmaps.asBufferedImage(pageBitmap);
+            long duration = System.currentTimeMillis() - time;
 
-      System.out.println((i + 1) + ": " + duration + " ms");
-      avg += duration;
+            System.out.println((i + 1) + ": " + duration + " ms");
+            avg += duration;
+        }
+        System.out.println("Average: " + avg / runs);
     }
-    System.out.println("Average: " + avg / runs);
-  }
-
-  @Ignore
-  @Test
-  public void composeTestWithDurationCalcAggregate() throws IOException, JBIG2Exception {
-    int runs = 40;
-    long avg = 0;
-    String path = "/images/002.jb2";
-    int pages = 17;
-
-    System.out.println("File: " + path);
 
-    InputStream is = getClass().getResourceAsStream(path);
-    DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
-    ImageInputStream iis = disf.getInputStream(is);
-
-    for (int j = 1; j <= pages; j++) {
-      avg = 0;
-
-      for (int i = 0; i < runs; i++) {
-        long time = System.currentTimeMillis();
-        JBIG2Document doc = new JBIG2Document(iis);
-        Bitmap pageBitmap = doc.getPage(j).getBitmap();
-        Bitmaps.asBufferedImage(pageBitmap);
-        long duration = System.currentTimeMillis() - time;
-        System.out.print((i + 1) + ": " + duration + " ms ");
-        avg += duration;
-      }
-      System.out.println();
-      System.out.println("Page " + j + " Average: " + avg / runs);
+    @Ignore
+    @Test
+    public void composeTestWithDurationCalcAggregate() throws IOException, JBIG2Exception
+    {
+        int runs = 40;
+        long avg = 0;
+        String path = "/images/002.jb2";
+        int pages = 17;
+
+        System.out.println("File: " + path);
+
+        InputStream is = getClass().getResourceAsStream(path);
+        DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
+        ImageInputStream iis = disf.getInputStream(is);
+
+        for (int j = 1; j <= pages; j++)
+        {
+            avg = 0;
+
+            for (int i = 0; i < runs; i++)
+            {
+                long time = System.currentTimeMillis();
+                JBIG2Document doc = new JBIG2Document(iis);
+                Bitmap pageBitmap = doc.getPage(j).getBitmap();
+                Bitmaps.asBufferedImage(pageBitmap);
+                long duration = System.currentTimeMillis() - time;
+                System.out.print((i + 1) + ": " + duration + " ms ");
+                avg += duration;
+            }
+            System.out.println();
+            System.out.println("Page " + j + " Average: " + avg / runs);
+        }
     }
-  }
 
 }

http://git-wip-us.apache.org/repos/asf/pdfbox-jbig2/blob/30839c32/src/test/java/org/apache/pdfbox/jbig2/PreconfiguredImageReadParam.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/pdfbox/jbig2/PreconfiguredImageReadParam.java b/src/test/java/org/apache/pdfbox/jbig2/PreconfiguredImageReadParam.java
index b8f58c0..e0f2cfa 100644
--- a/src/test/java/org/apache/pdfbox/jbig2/PreconfiguredImageReadParam.java
+++ b/src/test/java/org/apache/pdfbox/jbig2/PreconfiguredImageReadParam.java
@@ -22,35 +22,42 @@ import java.awt.Rectangle;
 
 import javax.imageio.ImageReadParam;
 
-public class PreconfiguredImageReadParam extends ImageReadParam {
-  public PreconfiguredImageReadParam(Rectangle sourceRegion) {
-    this.sourceRegion = sourceRegion;
-  }
-
-  public PreconfiguredImageReadParam(Dimension sourceRenderSize) {
-    this.sourceRenderSize = sourceRenderSize;
-  }
-
-  public PreconfiguredImageReadParam(int sourceXSubsampling, int sourceYSubsampling, int subsamplingXOffset,
-      int subsamplingYOffset) {
-    this.sourceXSubsampling = sourceXSubsampling;
-    this.sourceYSubsampling = sourceYSubsampling;
-    this.subsamplingXOffset = subsamplingXOffset;
-    this.subsamplingYOffset = subsamplingYOffset;
-  }
-
-  public PreconfiguredImageReadParam(Rectangle sourceRegion, Dimension sourceRenderSize) {
-    this.sourceRegion = sourceRegion;
-    this.sourceRenderSize = sourceRenderSize;
-  }
-
-  public PreconfiguredImageReadParam(Rectangle sourceRegion, Dimension sourceRenderSize, int sourceXSubsampling,
-      int sourceYSubsampling, int subsamplingXOffset, int subsamplingYOffset) {
-    this.sourceRegion = sourceRegion;
-    this.sourceRenderSize = sourceRenderSize;
-    this.sourceXSubsampling = sourceXSubsampling;
-    this.sourceYSubsampling = sourceYSubsampling;
-    this.subsamplingXOffset = subsamplingXOffset;
-    this.subsamplingYOffset = subsamplingYOffset;
-  }
-}
\ No newline at end of file
+public class PreconfiguredImageReadParam extends ImageReadParam
+{
+    public PreconfiguredImageReadParam(Rectangle sourceRegion)
+    {
+        this.sourceRegion = sourceRegion;
+    }
+
+    public PreconfiguredImageReadParam(Dimension sourceRenderSize)
+    {
+        this.sourceRenderSize = sourceRenderSize;
+    }
+
+    public PreconfiguredImageReadParam(int sourceXSubsampling, int sourceYSubsampling,
+            int subsamplingXOffset, int subsamplingYOffset)
+    {
+        this.sourceXSubsampling = sourceXSubsampling;
+        this.sourceYSubsampling = sourceYSubsampling;
+        this.subsamplingXOffset = subsamplingXOffset;
+        this.subsamplingYOffset = subsamplingYOffset;
+    }
+
+    public PreconfiguredImageReadParam(Rectangle sourceRegion, Dimension sourceRenderSize)
+    {
+        this.sourceRegion = sourceRegion;
+        this.sourceRenderSize = sourceRenderSize;
+    }
+
+    public PreconfiguredImageReadParam(Rectangle sourceRegion, Dimension sourceRenderSize,
+            int sourceXSubsampling, int sourceYSubsampling, int subsamplingXOffset,
+            int subsamplingYOffset)
+    {
+        this.sourceRegion = sourceRegion;
+        this.sourceRenderSize = sourceRenderSize;
+        this.sourceXSubsampling = sourceXSubsampling;
+        this.sourceYSubsampling = sourceYSubsampling;
+        this.subsamplingXOffset = subsamplingXOffset;
+        this.subsamplingYOffset = subsamplingYOffset;
+    }
+}


Mime
View raw message