You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ju...@apache.org on 2010/09/08 00:15:00 UTC

svn commit: r993545 - /tika/trunk/tika-core/src/main/java/org/apache/tika/io/TikaInputStream.java

Author: jukka
Date: Tue Sep  7 22:14:59 2010
New Revision: 993545

URL: http://svn.apache.org/viewvc?rev=993545&view=rev
Log:
TIKA-153: Allow passing of files or memory buffers to parsers

Add hasFile() and hasLength() predicates to allow downstream code to avoid potentially expensive operations.

Modified:
    tika/trunk/tika-core/src/main/java/org/apache/tika/io/TikaInputStream.java

Modified: tika/trunk/tika-core/src/main/java/org/apache/tika/io/TikaInputStream.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-core/src/main/java/org/apache/tika/io/TikaInputStream.java?rev=993545&r1=993544&r2=993545&view=diff
==============================================================================
--- tika/trunk/tika-core/src/main/java/org/apache/tika/io/TikaInputStream.java (original)
+++ tika/trunk/tika-core/src/main/java/org/apache/tika/io/TikaInputStream.java Tue Sep  7 22:14:59 2010
@@ -397,6 +397,10 @@ public class TikaInputStream extends Pro
         openContainer = container;
     }
 
+    public boolean hasFile() {
+        return file != null;
+    }
+
     public File getFile() throws IOException {
         if (file == null) {
             if (in == null) {
@@ -419,6 +423,10 @@ public class TikaInputStream extends Pro
         return file;
     }
 
+    public boolean hasLength() {
+        return length != -1;
+    }
+
     /**
      * Returns the length (in bytes) of this stream. Note that if the length
      * was not available when this stream was instantiated, then this method