You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by el...@apache.org on 2011/06/04 00:25:53 UTC
svn commit: r1131268 - in /hadoop/common/trunk: ./
src/java/org/apache/hadoop/fs/ src/java/org/apache/hadoop/fs/shell/
Author: eli
Date: Fri Jun 3 22:25:52 2011
New Revision: 1131268
URL: http://svn.apache.org/viewvc?rev=1131268&view=rev
Log:
HADOOP-7316. Add public javadocs to FSDataInputStream and FSDataOutputStream. Contributed by Eli Collins
Modified:
hadoop/common/trunk/CHANGES.txt
hadoop/common/trunk/src/java/org/apache/hadoop/fs/FSDataInputStream.java
hadoop/common/trunk/src/java/org/apache/hadoop/fs/FSDataOutputStream.java
hadoop/common/trunk/src/java/org/apache/hadoop/fs/PositionedReadable.java
hadoop/common/trunk/src/java/org/apache/hadoop/fs/shell/Command.java
hadoop/common/trunk/src/java/org/apache/hadoop/fs/shell/FsCommand.java
Modified: hadoop/common/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/CHANGES.txt?rev=1131268&r1=1131267&r2=1131268&view=diff
==============================================================================
--- hadoop/common/trunk/CHANGES.txt (original)
+++ hadoop/common/trunk/CHANGES.txt Fri Jun 3 22:25:52 2011
@@ -190,6 +190,9 @@ Trunk (unreleased changes)
HADOOP-7331. Make hadoop-daemon.sh return exit code 1 if daemon processes
did not get started. (Tanping Wang via todd)
+ HADOOP-7316. Add public javadocs to FSDataInputStream and
+ FSDataOutputStream. (eli)
+
OPTIMIZATIONS
HADOOP-7333. Performance improvement in PureJavaCrc32. (Eric Caspole
Modified: hadoop/common/trunk/src/java/org/apache/hadoop/fs/FSDataInputStream.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/java/org/apache/hadoop/fs/FSDataInputStream.java?rev=1131268&r1=1131267&r2=1131268&view=diff
==============================================================================
--- hadoop/common/trunk/src/java/org/apache/hadoop/fs/FSDataInputStream.java (original)
+++ hadoop/common/trunk/src/java/org/apache/hadoop/fs/FSDataInputStream.java Fri Jun 3 22:25:52 2011
@@ -38,34 +38,81 @@ public class FSDataInputStream extends D
}
}
+ /**
+ * Seek to the given offset.
+ *
+ * @param desired offset to seek to
+ */
public synchronized void seek(long desired) throws IOException {
((Seekable)in).seek(desired);
}
+ /**
+ * Get the current position in the input stream.
+ *
+ * @return current position in the input stream
+ */
public long getPos() throws IOException {
return ((Seekable)in).getPos();
}
+ /**
+ * Read bytes from the given position in the stream to the given buffer.
+ *
+ * @param position position in the input stream to seek
+ * @param buffer buffer into which data is read
+ * @param offset offset into the buffer in which data is written
+ * @param length maximum number of bytes to read
+ * @return total number of bytes read into the buffer, or <code>-1</code>
+ * if there is no more data because the end of the stream has been
+ * reached
+ */
public int read(long position, byte[] buffer, int offset, int length)
throws IOException {
return ((PositionedReadable)in).read(position, buffer, offset, length);
}
-
+
+ /**
+ * Read bytes from the given position in the stream to the given buffer.
+ * Continues to read until <code>length</code> bytes have been read.
+ *
+ * @param position position in the input stream to seek
+ * @param buffer buffer into which data is read
+ * @param offset offset into the buffer in which data is written
+ * @param length the number of bytes to read
+ * @throws EOFException If the end of stream is reached while reading.
+ * If an exception is thrown an undetermined number
+ * of bytes in the buffer may have been written.
+ */
public void readFully(long position, byte[] buffer, int offset, int length)
throws IOException {
((PositionedReadable)in).readFully(position, buffer, offset, length);
}
+ /**
+ * See {@link #readFully(long, byte[], int, int)}.
+ */
public void readFully(long position, byte[] buffer)
throws IOException {
((PositionedReadable)in).readFully(position, buffer, 0, buffer.length);
}
+ /**
+ * Seek to the given position on an alternate copy of the data.
+ *
+ * @param targetPos position to seek to
+ * @return true if a new source is found, false otherwise
+ */
public boolean seekToNewSource(long targetPos) throws IOException {
return ((Seekable)in).seekToNewSource(targetPos);
}
- // Returns the underlying input stream. This is used by unit tests.
+ /**
+ * Get a reference to the wrapped input stream. Used by unit tests.
+ *
+ * @return the underlying input stream
+ */
+ @InterfaceAudience.LimitedPrivate({"HDFS"})
public InputStream getWrappedStream() {
return in;
}
Modified: hadoop/common/trunk/src/java/org/apache/hadoop/fs/FSDataOutputStream.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/java/org/apache/hadoop/fs/FSDataOutputStream.java?rev=1131268&r1=1131267&r2=1131268&view=diff
==============================================================================
--- hadoop/common/trunk/src/java/org/apache/hadoop/fs/FSDataOutputStream.java (original)
+++ hadoop/common/trunk/src/java/org/apache/hadoop/fs/FSDataOutputStream.java Fri Jun 3 22:25:52 2011
@@ -83,15 +83,28 @@ public class FSDataOutputStream extends
wrappedStream = out;
}
+ /**
+ * Get the current position in the output stream.
+ *
+ * @return the current position in the output stream
+ */
public long getPos() throws IOException {
return ((PositionCache)out).getPos();
}
+ /**
+ * Close the underlying output stream.
+ */
public void close() throws IOException {
- out.close(); // This invokes PositionCache.close()
+ out.close(); // This invokes PositionCache.close()
}
- // Returns the underlying output stream. This is used by unit tests.
+ /**
+ * Get a reference to the wrapped output stream. Used by unit tests.
+ *
+ * @return the underlying output stream
+ */
+ @InterfaceAudience.LimitedPrivate({"HDFS"})
public OutputStream getWrappedStream() {
return wrappedStream;
}
Modified: hadoop/common/trunk/src/java/org/apache/hadoop/fs/PositionedReadable.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/java/org/apache/hadoop/fs/PositionedReadable.java?rev=1131268&r1=1131267&r2=1131268&view=diff
==============================================================================
--- hadoop/common/trunk/src/java/org/apache/hadoop/fs/PositionedReadable.java (original)
+++ hadoop/common/trunk/src/java/org/apache/hadoop/fs/PositionedReadable.java Fri Jun 3 22:25:52 2011
@@ -21,7 +21,6 @@ import java.io.*;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
-import org.apache.hadoop.fs.*;
/** Stream that permits positional reading. */
@InterfaceAudience.Public
Modified: hadoop/common/trunk/src/java/org/apache/hadoop/fs/shell/Command.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/java/org/apache/hadoop/fs/shell/Command.java?rev=1131268&r1=1131267&r2=1131268&view=diff
==============================================================================
--- hadoop/common/trunk/src/java/org/apache/hadoop/fs/shell/Command.java (original)
+++ hadoop/common/trunk/src/java/org/apache/hadoop/fs/shell/Command.java Fri Jun 3 22:25:52 2011
@@ -232,7 +232,7 @@ abstract public class Command extends Co
* Processes a {@link PathData} item, calling
* {@link #processPathArgument(PathData)} or
* {@link #processNonexistentPath(PathData)} on each item.
- * @param arg {@link PathData} item to process
+ * @param item {@link PathData} item to process
* @throws IOException if anything goes wrong...
*/
protected void processArgument(PathData item) throws IOException {
Modified: hadoop/common/trunk/src/java/org/apache/hadoop/fs/shell/FsCommand.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/java/org/apache/hadoop/fs/shell/FsCommand.java?rev=1131268&r1=1131267&r2=1131268&view=diff
==============================================================================
--- hadoop/common/trunk/src/java/org/apache/hadoop/fs/shell/FsCommand.java (original)
+++ hadoop/common/trunk/src/java/org/apache/hadoop/fs/shell/FsCommand.java Fri Jun 3 22:25:52 2011
@@ -75,7 +75,7 @@ abstract public class FsCommand extends
throw new RuntimeException("not supposed to get here");
}
- /** @deprecated use {@link #run(String...argv)} */
+ /** @deprecated use {@link Command#run(String...argv)} */
@Deprecated
@Override
public int runAll() {