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/04/27 17:34:22 UTC
svn commit: r938525 -
/lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/io/TikaInputStream.java
Author: jukka
Date: Tue Apr 27 15:34:22 2010
New Revision: 938525
URL: http://svn.apache.org/viewvc?rev=938525&view=rev
Log:
TIKA-153: Allow passing of files or memory buffers to parsers
Some javadocs
Modified:
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/io/TikaInputStream.java
Modified: lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/io/TikaInputStream.java
URL: http://svn.apache.org/viewvc/lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/io/TikaInputStream.java?rev=938525&r1=938524&r2=938525&view=diff
==============================================================================
--- lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/io/TikaInputStream.java (original)
+++ lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/io/TikaInputStream.java Tue Apr 27 15:34:22 2010
@@ -23,8 +23,20 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+/**
+ *
+ * @since Apache Tika 0.8
+ */
public class TikaInputStream extends ProxyInputStream {
+ /**
+ * Casts or wraps the given stream to a TikaInputStream instance.
+ * This method can be used to access the functionality of this class
+ * even when given just a normal input stream instance.
+ *
+ * @param stream normal input stream
+ * @return a TikaInputStream instance
+ */
public static TikaInputStream get(InputStream stream) {
if (stream instanceof TikaInputStream) {
return (TikaInputStream) stream;
@@ -33,10 +45,24 @@ public class TikaInputStream extends Pro
}
}
+ /**
+ * The file that contains the contents of this stream. This is either
+ * the original file passed to the {@link #TikaInputStream(File)}
+ * constructor or a temporary file created by a call to the
+ * {@link #getFile()} method. If neither has been called, then
+ * the value is <code>null</code>.
+ */
private File file;
+ /**
+ * Flag to indicate that {@link #file} is a temporary file that should
+ * be removed when this stream is {@link #close() closed}.
+ */
private boolean temporary;
+ /**
+ * Current read position within this stream.
+ */
private long position = 0;
public TikaInputStream(InputStream stream) {