forked from seaweedfs/seaweedfs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
51 additions
and
2 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
other/java/hdfs2/src/main/java/seaweed/hdfs/SeaweedFileSystem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
other/java/hdfs3/src/main/java/seaweed/hdfs/BufferedSeaweedInputStream.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package seaweed.hdfs; | ||
|
||
import org.apache.hadoop.fs.PositionedReadable; | ||
import org.apache.hadoop.fs.Seekable; | ||
|
||
import java.io.BufferedInputStream; | ||
import java.io.FilterInputStream; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
|
||
class BufferedSeaweedInputStream extends FilterInputStream implements Seekable, PositionedReadable { | ||
|
||
SeaweedInputStream t; | ||
|
||
protected BufferedSeaweedInputStream(InputStream in, int bufferSize) { | ||
super(new BufferedInputStream(in, bufferSize)); | ||
t = (SeaweedInputStream)in; | ||
} | ||
|
||
@Override | ||
public int read(long position, byte[] buffer, int offset, int length) throws IOException { | ||
return this.t.read(position,buffer,offset,length); | ||
} | ||
|
||
@Override | ||
public void readFully(long position, byte[] buffer, int offset, int length) throws IOException { | ||
this.t.readFully(position,buffer,offset,length); | ||
} | ||
|
||
@Override | ||
public void readFully(long position, byte[] buffer) throws IOException { | ||
this.t.readFully(position,buffer); | ||
} | ||
|
||
@Override | ||
public void seek(long pos) throws IOException { | ||
this.t.seek(pos); | ||
} | ||
|
||
@Override | ||
public long getPos() throws IOException { | ||
return this.t.getPos(); | ||
} | ||
|
||
@Override | ||
public boolean seekToNewSource(long targetPos) throws IOException { | ||
return this.t.seekToNewSource(targetPos); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters