pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1571822 - /pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/filter/LZWFilter.java
Date Tue, 25 Feb 2014 21:02:56 GMT
Author: tilman
Date: Tue Feb 25 21:02:55 2014
New Revision: 1571822

URL: http://svn.apache.org/r1571822
Log:
PDFBOX-1147: code modified for JDK5

Modified:
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/filter/LZWFilter.java

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/filter/LZWFilter.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/filter/LZWFilter.java?rev=1571822&r1=1571821&r2=1571822&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/filter/LZWFilter.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/filter/LZWFilter.java Tue Feb
25 21:02:55 2014
@@ -88,7 +88,9 @@ public class LZWFilter implements Filter
                         if (prevCommand != -1)
                         {
                             data = codeTable.get((int) prevCommand);
-                            byte[] newData = Arrays.copyOf(data, data.length + 1);
+                            byte[] newData = new byte[data.length + 1];
+                            for (int i = 0; i < data.length; ++i)
+                                newData[i] = data[i];
                             newData[data.length] = firstByte;
                             codeTable.add(newData);
                         }
@@ -96,7 +98,9 @@ public class LZWFilter implements Filter
                     else
                     {
                         byte[] data = codeTable.get((int) prevCommand);
-                        byte[] newData = Arrays.copyOf(data, data.length + 1);
+                        byte[] newData = new byte[data.length + 1];
+                        for (int i = 0; i < data.length; ++i)
+                            newData[i] = data[i];
                         newData[data.length] = data[0];
                         result.write(newData);
                         codeTable.add(newData);
@@ -155,7 +159,10 @@ public class LZWFilter implements Filter
             }
             else
             {
-                inputPattern = Arrays.copyOf(inputPattern, inputPattern.length + 1);
+                byte[] inputPatternCopy = new byte[inputPattern.length + 1];
+                for (int i = 0; i < inputPattern.length; ++i)
+                    inputPatternCopy[i] = inputPattern[i];
+                inputPattern = inputPatternCopy;
                 inputPattern[inputPattern.length - 1] = by;
                 int newFoundCode = findPatternCode(codeTable, inputPattern);
                 if (newFoundCode == -1)



Mime
View raw message