Interface EmuUnixFileDescriptor<T>
- Type Parameters:
T- the type of values stored in the file
- All Known Implementing Classes:
AbsEmuUnixFileHandle, AbstractEmuUnixFileHandle, AbstractStreamEmuUnixFileHandle, DefaultEmuUnixFileHandle, IOStreamEmuUnixFileHandle
public interface EmuUnixFileDescriptor<T>
A process's handle to a file (or other resource)
-
Field Summary
Fields -
Method Summary
ChangeModifier and TypeMethodDescriptionvoidclose()Close this descriptorReturns the current offset of the file, or 0 if not applicable.longReturns the current offset of the file, or 0 if not applicable.intRead from the file opened by this handlereadAbstract(T buf) Read from the file opened by this handlevoidseek(long offset) Seek to the given offsetvoidSeek to the given offsetstat()Returns thestatstructure of the file opened by this handle.intWrite into the file opened by this handlewriteAbstract(T buf) Write into the file opened by this handle
-
Field Details
-
FD_STDIN
static final int FD_STDINThe default file descriptor for stdin (standard input)- See Also:
-
FD_STDOUT
static final int FD_STDOUTThe default file descriptor for stdout (standard output)- See Also:
-
FD_STDERR
static final int FD_STDERRThe default file descriptor for stderr (standard error output)- See Also:
-
-
Method Details
-
getAbstractOffset NEW
T getAbstractOffset()Returns the current offset of the file, or 0 if not applicable.- Returns:
- the current offset of the file, or 0 if not applicable
-
getOffset MODIFIED
long getOffset()return type: T → long-T getOffset()+long getOffset()Returns the current offset of the file, or 0 if not applicable.- Returns:
- the current offset of the file, or 0 if not applicable
-
seek
Seek to the given offset- Parameters:
offset- the desired offset- Throws:
EmuIOException- if an error occurred
-
seek NEW
Seek to the given offset- Parameters:
offset- the desired offset- Throws:
EmuIOException- if an error occurred
-
readAbstract NEW
Read from the file opened by this handle- Parameters:
buf- the destination buffer- Returns:
- the number of bytes read
- Throws:
EmuIOException- if an error occurred
-
read MODIFIED
return type: T → int-T read(T buf) throws EmuIOException+int read(T buf) throws EmuIOExceptionRead from the file opened by this handle- Parameters:
buf- the destination buffer- Returns:
- the number of bytes read
- Throws:
EmuIOException- if an error occurred
-
writeAbstract NEW
Write into the file opened by this handle- Parameters:
buf- the source buffer- Returns:
- the number of bytes written
- Throws:
EmuIOException- if an error occurred
-
write MODIFIED
return type: T → int-T write(T buf) throws EmuIOException+int write(T buf) throws EmuIOExceptionWrite into the file opened by this handle- Parameters:
buf- the source buffer- Returns:
- the number of bytes written
- Throws:
EmuIOException- if an error occurred
-
stat
EmuUnixFileStat stat()Returns thestatstructure of the file opened by this handle.- Returns:
- the
statstructure of the file opened by this handle
-
close
void close()Close this descriptor
-