You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2010/06/13 19:23:05 UTC
svn commit: r954269 - in
/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter:
ASCIIHexFilter.java CCITTFaxDecodeFilter.java DCTFilter.java
RunLengthDecodeFilter.java
Author: lehmi
Date: Sun Jun 13 17:23:05 2010
New Revision: 954269
URL: http://svn.apache.org/viewvc?rev=954269&view=rev
Log:
PDFBOX-742: using logging instead of System.out/err. Hint by Antoni Mylka (antoni dot mylka at aduna-software dot com)
Modified:
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/ASCIIHexFilter.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/CCITTFaxDecodeFilter.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/DCTFilter.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/RunLengthDecodeFilter.java
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/ASCIIHexFilter.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/ASCIIHexFilter.java?rev=954269&r1=954268&r2=954269&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/ASCIIHexFilter.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/ASCIIHexFilter.java Sun Jun 13 17:23:05 2010
@@ -20,6 +20,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.pdfbox.cos.COSDictionary;
import org.apache.pdfbox.persistence.util.COSHEXTable;
@@ -34,6 +36,10 @@ public class ASCIIHexFilter implements F
{
/**
+ * Log instance.
+ */
+ private static final Log log = LogFactory.getLog(ASCIIHexFilter.class);
+ /**
* Whitespace.
* 0 0x00 Null (NUL)
* 9 0x09 Tab (HT)
@@ -76,7 +82,7 @@ public class ASCIIHexFilter implements F
if(REVERSE_HEX[firstByte] == -1)
{
- System.out.println("Invalid Hex Code; int: " + firstByte + " char: " + (char) firstByte);
+ log.error("Invalid Hex Code; int: " + firstByte + " char: " + (char) firstByte);
}
value = REVERSE_HEX[firstByte] * 16;
secondByte = compressedData.read();
@@ -91,7 +97,7 @@ public class ASCIIHexFilter implements F
{
if(REVERSE_HEX[secondByte] == -1)
{
- System.out.println("Invalid Hex Code; int: " + secondByte + " char: " + (char) secondByte);
+ log.error("Invalid Hex Code; int: " + secondByte + " char: " + (char) secondByte);
}
value += REVERSE_HEX[secondByte];
}
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/CCITTFaxDecodeFilter.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/CCITTFaxDecodeFilter.java?rev=954269&r1=954268&r2=954269&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/CCITTFaxDecodeFilter.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/CCITTFaxDecodeFilter.java Sun Jun 13 17:23:05 2010
@@ -23,6 +23,8 @@ import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.pdfbox.cos.COSArray;
import org.apache.pdfbox.cos.COSBase;
import org.apache.pdfbox.cos.COSDictionary;
@@ -38,6 +40,11 @@ import org.apache.pdfbox.cos.COSName;
*/
public class CCITTFaxDecodeFilter implements Filter
{
+ /**
+ * Log instance.
+ */
+ private static final Log log = LogFactory.getLog(CCITTFaxDecodeFilter.class);
+
// Filter will write 15 TAG's
// If you add or remove TAG's you will have to modify this value
private static final int TAG_COUNT = 15;
@@ -64,10 +71,6 @@ public class CCITTFaxDecodeFilter implem
public void decode(InputStream compressedData, OutputStream result, COSDictionary options, int filterIndex)
throws IOException
{
- // log.warn( "Warning: CCITTFaxDecode.decode is not implemented yet,
- // skipping this stream." );
-
-
// Get ImageParams from PDF
COSBase baseObj = options.getDictionaryObject(new String[] {"DecodeParms","DP"});
COSDictionary dict = null;
@@ -97,11 +100,11 @@ public class CCITTFaxDecodeFilter implem
+ baseObj.getClass().getName() );
}
- int width = options.getInt("Width");
- int height = options.getInt("Height");
+ int width = options.getInt(COSName.WIDTH);
+ int height = options.getInt(COSName.HEIGHT);
int length = options.getInt(COSName.LENGTH);
- int compressionType = dict.getInt("K");
- boolean blackIs1 = dict.getBoolean("BlackIs1", false);
+ int compressionType = dict.getInt(COSName.K);
+ boolean blackIs1 = dict.getBoolean(COSName.BLACK_IS_1, false);
// HEADER-INFO and starting point of TAG-DICTIONARY
@@ -127,7 +130,6 @@ public class CCITTFaxDecodeFilter implem
result.write(buffer, 0, Math.min(lentoread, 32768));
lentoread = lentoread - Math.min(lentoread, 32738);
}
- //System.out.println("Gelesen: " + sum);
// TAG-COUNT
writeTagCount(result);
@@ -192,7 +194,6 @@ public class CCITTFaxDecodeFilter implem
byte[] header = { 'M', 'M', 0, '*' };// Big-endian
result.write(header);
-
// Add imagelength to offset
offset += length;
@@ -726,6 +727,6 @@ public class CCITTFaxDecodeFilter implem
public void encode(InputStream rawData, OutputStream result, COSDictionary options, int filterIndex )
throws IOException
{
- System.err.println("Warning: CCITTFaxDecode.encode is not implemented yet, skipping this stream.");
+ log.warn("CCITTFaxDecode.encode is not implemented yet, skipping this stream.");
}
}
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/DCTFilter.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/DCTFilter.java?rev=954269&r1=954268&r2=954269&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/DCTFilter.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/DCTFilter.java Sun Jun 13 17:23:05 2010
@@ -20,6 +20,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.pdfbox.cos.COSDictionary;
/**
@@ -32,12 +34,17 @@ public class DCTFilter implements Filter
{
/**
+ * Log instance.
+ */
+ private static final Log log = LogFactory.getLog(DCTFilter.class);
+
+ /**
* {@inheritDoc}
*/
public void decode( InputStream compressedData, OutputStream result, COSDictionary options, int filterIndex )
throws IOException
{
- System.err.println( "Warning: DCTFilter.decode is not implemented yet, skipping this stream." );
+ log.warn( "DCTFilter.decode is not implemented yet, skipping this stream." );
}
/**
@@ -46,6 +53,6 @@ public class DCTFilter implements Filter
public void encode( InputStream rawData, OutputStream result, COSDictionary options, int filterIndex )
throws IOException
{
- System.err.println( "Warning: DCTFilter.encode is not implemented yet, skipping this stream." );
+ log.warn( "DCTFilter.encode is not implemented yet, skipping this stream." );
}
}
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/RunLengthDecodeFilter.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/RunLengthDecodeFilter.java?rev=954269&r1=954268&r2=954269&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/RunLengthDecodeFilter.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/RunLengthDecodeFilter.java Sun Jun 13 17:23:05 2010
@@ -20,6 +20,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.pdfbox.cos.COSDictionary;
/**
@@ -46,6 +48,11 @@ import org.apache.pdfbox.cos.COSDictiona
*/
public class RunLengthDecodeFilter implements Filter
{
+ /**
+ * Log instance.
+ */
+ private static final Log log = LogFactory.getLog(RunLengthDecodeFilter.class);
+
private static final int RUN_LENGTH_EOD = 128;
/**
@@ -94,6 +101,6 @@ public class RunLengthDecodeFilter imple
public void encode( InputStream rawData, OutputStream result, COSDictionary options, int filterIndex )
throws IOException
{
- System.err.println( "Warning: RunLengthDecodeFilter.encode is not implemented yet, skipping this stream." );
+ log.warn( "RunLengthDecodeFilter.encode is not implemented yet, skipping this stream." );
}
}