HADOOP-7301. FSDataInputStream should expose a getWrappedStream method. Contributed by Jonathan Hsieh
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1124406 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d1eaaf30e2
commit
14fd85cdc5
@ -161,6 +161,9 @@ Trunk (unreleased changes)
|
|||||||
HADOOP-7286. Refactor the du/dus/df commands to conform to new FsCommand
|
HADOOP-7286. Refactor the du/dus/df commands to conform to new FsCommand
|
||||||
class. (Daryn Sharp via todd)
|
class. (Daryn Sharp via todd)
|
||||||
|
|
||||||
|
HADOOP-7301. FSDataInputStream should expose a getWrappedStream method.
|
||||||
|
(Jonathan Hsieh via eli)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
|
@ -64,4 +64,9 @@ public void readFully(long position, byte[] buffer)
|
|||||||
public boolean seekToNewSource(long targetPos) throws IOException {
|
public boolean seekToNewSource(long targetPos) throws IOException {
|
||||||
return ((Seekable)in).seekToNewSource(targetPos);
|
return ((Seekable)in).seekToNewSource(targetPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns the underlying input stream. This is used by unit tests.
|
||||||
|
public InputStream getWrappedStream() {
|
||||||
|
return in;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1044,6 +1045,16 @@ public void testOutputStreamClosedTwice() throws IOException {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetWrappedInputStream() throws IOException {
|
||||||
|
Path src = getTestRootPath(fSys, "test/hadoop/file");
|
||||||
|
createFile(src);
|
||||||
|
FSDataInputStream in = fSys.open(src);
|
||||||
|
InputStream is = in.getWrappedStream();
|
||||||
|
in.close();
|
||||||
|
Assert.assertNotNull(is);
|
||||||
|
}
|
||||||
|
|
||||||
protected void createFile(Path path) throws IOException {
|
protected void createFile(Path path) throws IOException {
|
||||||
FileSystemTestHelper.createFile(fSys, path);
|
FileSystemTestHelper.createFile(fSys, path);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user