commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grobme...@apache.org
Subject svn commit: r763578 - in /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar: TarArchiveInputStream.java TarArchiveOutputStream.java TarBuffer.java
Date Thu, 09 Apr 2009 09:32:01 GMT
Author: grobmeier
Date: Thu Apr  9 09:31:51 2009
New Revision: 763578

URL: http://svn.apache.org/viewvc?rev=763578&view=rev
Log:
removed debug flag and console outputs

Modified:
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarBuffer.java

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java?rev=763578&r1=763577&r2=763578&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
Thu Apr  9 09:31:51 2009
@@ -42,7 +42,6 @@
     private static final int BUFFER_SIZE = 8 * 1024;
     private static final int LARGE_BUFFER_SIZE = 32 * 1024;
 
-    private boolean debug;
     private boolean hasHitEOF;
     private long entrySize;
     private long entryOffset;
@@ -76,21 +75,10 @@
     public TarArchiveInputStream(InputStream is, int blockSize, int recordSize) {
         this.buffer = new TarBuffer(is, blockSize, recordSize);
         this.readBuf = null;
-        this.debug = false;
         this.hasHitEOF = false;
     }
 
     /**
-     * Sets the debugging flag.
-     *
-     * @param debug True to turn on debugging.
-     */
-    public void setDebug(boolean debug) {
-        this.debug = debug;
-        buffer.setDebug(debug);
-    }
-
-    /**
      * Closes this stream. Calls the TarBuffer's close() method.
      * @throws IOException on error
      */
@@ -181,14 +169,6 @@
         if (currEntry != null) {
             long numToSkip = entrySize - entryOffset;
 
-            if (debug) {
-                System.err.println("TarInputStream: SKIP currENTRY '"
-                                   + currEntry.getName() + "' SZ "
-                                   + entrySize + " OFF "
-                                   + entryOffset + "  skipping "
-                                   + numToSkip + " bytes");
-            }
-
             while (numToSkip > 0) {
                 long skipped = skip(numToSkip);
                 if (skipped <= 0) {
@@ -204,14 +184,8 @@
         byte[] headerBuf = buffer.readRecord();
 
         if (headerBuf == null) {
-            if (debug) {
-                System.err.println("READ NULL RECORD");
-            }
             hasHitEOF = true;
         } else if (buffer.isEOFRecord(headerBuf)) {
-            if (debug) {
-                System.err.println("READ EOF RECORD");
-            }
             hasHitEOF = true;
         }
 
@@ -219,16 +193,7 @@
             currEntry = null;
         } else {
             currEntry = new TarArchiveEntry(headerBuf);
-
-            if (debug) {
-                System.err.println("TarInputStream: SET CURRENTRY '"
-                                   + currEntry.getName()
-                                   + "' size = "
-                                   + currEntry.getSize());
-            }
-
             entryOffset = 0;
-
             entrySize = currEntry.getSize();
         }
 

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java?rev=763578&r1=763577&r2=763578&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
Thu Apr  9 09:31:51 2009
@@ -40,7 +40,6 @@
     /** GNU tar extensions are used to store long file names in the archive. */
     public static final int LONGFILE_GNU = 2;
 
-    private boolean   debug;// NOT READ
     private long      currSize;
     private String    currName;
     private long      currBytes;
@@ -81,7 +80,6 @@
         out = os;
 
         this.buffer = new TarBuffer(os, blockSize, recordSize);
-        this.debug = false;
         this.assemLen = 0;
         this.assemBuf = new byte[recordSize];
         this.recordBuf = new byte[recordSize];
@@ -100,24 +98,6 @@
 
 
     /**
-     * Sets the debugging flag.
-     *
-     * @param debugF True to turn on debugging.
-     */
-    public void setDebug(boolean debugF) {
-        this.debug = debugF;
-    }
-
-    /**
-     * Sets the debugging flag in this stream's TarBuffer.
-     *
-     * @param debug True to turn on debugging.
-     */
-    public void setBufferDebug(boolean debug) {
-        buffer.setDebug(debug);
-    }
-
-    /**
      * Ends the TAR archive without closing the underlying OutputStream.
      * The result is that the two EOF records of nulls are written.
      * @throws IOException on error

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarBuffer.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarBuffer.java?rev=763578&r1=763577&r2=763578&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarBuffer.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarBuffer.java
Thu Apr  9 09:31:51 2009
@@ -52,8 +52,7 @@
     private int             blockSize;
     private int             recordSize;
     private int             recsPerBlock;
-    private boolean         debug;
-
+    
     /**
      * Constructor for a TarBuffer on an input stream.
      * @param inStream the input stream to use
@@ -118,7 +117,6 @@
      * Initialization common to all constructors.
      */
     private void initialize(int blockSize, int recordSize) {
-        this.debug = false;
         this.blockSize = blockSize;
         this.recordSize = recordSize;
         this.recsPerBlock = (this.blockSize / this.recordSize);
@@ -150,15 +148,6 @@
     }
 
     /**
-     * Set the debugging flag for the buffer.
-     *
-     * @param debug If true, print debugging output.
-     */
-    public void setDebug(boolean debug) {
-        this.debug = debug;
-    }
-
-    /**
      * Determine if an archive record indicate End of Archive. End of
      * archive is indicated by a record that consists entirely of null bytes.
      *
@@ -180,11 +169,6 @@
      * @throws IOException on error
      */
     public void skipRecord() throws IOException {
-        if (debug) {
-            System.err.println("SkipRecord: recIdx = " + currRecIdx
-                               + " blkIdx = " + currBlkIdx);
-        }
-
         if (inStream == null) {
             throw new IOException("reading (via skip) from an output buffer");
         }
@@ -205,11 +189,6 @@
      * @throws IOException on error
      */
     public byte[] readRecord() throws IOException {
-        if (debug) {
-            System.err.println("ReadRecord: recIdx = " + currRecIdx
-                               + " blkIdx = " + currBlkIdx);
-        }
-
         if (inStream == null) {
             if (outStream == null) {
                 throw new IOException("input buffer is closed");
@@ -238,10 +217,6 @@
      * @return false if End-Of-File, else true
      */
     private boolean readBlock() throws IOException {
-        if (debug) {
-            System.err.println("ReadBlock: blkIdx = " + currBlkIdx);
-        }
-
         if (inStream == null) {
             throw new IOException("reading from an output buffer");
         }
@@ -290,11 +265,7 @@
             bytesNeeded -= numBytes;
 
             if (numBytes != blockSize) {
-                if (debug) {
-                    System.err.println("ReadBlock: INCOMPLETE READ "
-                                       + numBytes + " of " + blockSize
-                                       + " bytes read.");
-                }
+                // TODO: Incomplete Read occured - throw exception?
             }
         }
 
@@ -329,11 +300,6 @@
      * @throws IOException on error
      */
     public void writeRecord(byte[] record) throws IOException {
-        if (debug) {
-            System.err.println("WriteRecord: recIdx = " + currRecIdx
-                               + " blkIdx = " + currBlkIdx);
-        }
-
         if (outStream == null) {
             if (inStream == null){
                 throw new IOException("Output buffer is closed");
@@ -369,11 +335,6 @@
      * @throws IOException on error
      */
     public void writeRecord(byte[] buf, int offset) throws IOException {
-        if (debug) {
-            System.err.println("WriteRecord: recIdx = " + currRecIdx
-                               + " blkIdx = " + currBlkIdx);
-        }
-
         if (outStream == null) {
             if (inStream == null){
                 throw new IOException("Output buffer is closed");
@@ -403,10 +364,6 @@
      * Write a TarBuffer block to the archive.
      */
     private void writeBlock() throws IOException {
-        if (debug) {
-            System.err.println("WriteBlock: blkIdx = " + currBlkIdx);
-        }
-
         if (outStream == null) {
             throw new IOException("writing to an input buffer");
         }
@@ -422,10 +379,6 @@
      * Flush the current data block if it has any data in it.
      */
     private void flushBlock() throws IOException {
-        if (debug) {
-            System.err.println("TarBuffer.flushBlock() called.");
-        }
-
         if (outStream == null) {
             throw new IOException("writing to an input buffer");
         }
@@ -441,10 +394,6 @@
      * @throws IOException on error
      */
     public void close() throws IOException {
-        if (debug) {
-            System.err.println("TarBuffer.closeBuffer().");
-        }
-
         if (outStream != null) {
             flushBlock();
 



Mime
View raw message