Package alluxio.underfs.cephfs
Class CephInputStream
- java.lang.Object
-
- java.io.InputStream
-
- alluxio.underfs.cephfs.CephInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
@NotThreadSafe public final class CephInputStream extends java.io.InputStreamA stream for reading a file from CephFS.
-
-
Constructor Summary
Constructors Constructor Description CephInputStream(com.ceph.fs.CephMount mount, int fh, long flength)Create a new CephInputStream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()voidclose()longgetPos()Gets the current position of the stream.intread()intread(byte[] buf, int off, int len)voidseek(long targetPos)Seek.longskip(long n)
-
-
-
Constructor Detail
-
CephInputStream
public CephInputStream(com.ceph.fs.CephMount mount, int fh, long flength)Create a new CephInputStream.- Parameters:
mount- CephFileSystem mountfh- The filehandle provided by Ceph to referenceflength- The current length of the file. If the length changes you will need to close and re-open it to access the new data
-
-
Method Detail
-
getPos
public long getPos() throws java.io.IOExceptionGets the current position of the stream.- Returns:
- current positon of the stream
- Throws:
java.io.IOException
-
available
public int available() throws java.io.IOException- Overrides:
availablein classjava.io.InputStream- Throws:
java.io.IOException
-
seek
public void seek(long targetPos) throws java.io.IOExceptionSeek.- Parameters:
targetPos- Position- Throws:
java.io.IOException- throws
-
skip
public long skip(long n) throws java.io.IOException- Overrides:
skipin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read() throws java.io.IOException- Specified by:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] buf, int off, int len) throws java.io.IOException- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream- Throws:
java.io.IOException
-
-