T1
- the concrete input stream subclassT2
- the concrete output stream subclass@NotThreadSafe public final class OpenFileEntry<T1 extends InputStream,T2 extends OutputStream> extends Object implements Closeable
AlluxioFuseFileSystem
) to check that.
This mechanism is preferred over more complex sub-classing to avoid useless casts or type checks
for every read/write call, which happen quite often.Constructor and Description |
---|
OpenFileEntry(long id,
String path,
T1 in,
T2 out)
Constructs a new
OpenFileEntry for an Alluxio file. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the underlying open streams.
|
long |
getId() |
T1 |
getIn()
Gets the opened input stream for this open file entry.
|
T2 |
getOut()
Gets the opened output stream for this open file entry.
|
String |
getPath() |
long |
getWriteOffset() |
void |
setPath(String path)
Sets the path of the file.
|
void |
setWriteOffset(long offset)
Sets the offset of the next write.
|
public OpenFileEntry(long id, String path, T1 in, T2 out)
OpenFileEntry
for an Alluxio file.id
- the id of the filepath
- the path of the filein
- the input stream of the fileout
- the output stream of the filepublic long getId()
public String getPath()
@Nullable public T1 getIn()
null
if the file is not open for reading.@Nullable public T2 getOut()
null
if the file is not open for writing.public long getWriteOffset()
public void setPath(String path)
path
- the new path of the filepublic void setWriteOffset(long offset)
offset
- the new offset of the next writepublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2023. All Rights Reserved.