jaulib v1.1.2-115-g39e35fd
Jau Support Library (C++, Java, ..)
|
File based byte output stream, including named file descriptor. More...
Public Member Functions | |
ByteOutStream_File (final String path, final FMode mode) | |
Construct a stream based byte output stream from filesystem path, either an existing or new file. More... | |
ByteOutStream_File (final int dirfd, final String path, final FMode mode) | |
Construct a stream based byte output stream from filesystem path and parent directory file descriptor, either an existing or new file. More... | |
ByteOutStream_File (final int fd) | |
Construct a stream based byte output stream by duplicating given file descriptor. More... | |
native void | closeStream () |
Close the stream if supported by the underlying mechanism. More... | |
void | close () |
Close the stream if supported by the underlying mechanism and dispose the native instance. More... | |
void | finalize () |
native boolean | is_open () |
Checks if the stream has an associated file. More... | |
void | clear (final IOState state) |
Clears state flags by assignment to the given value. More... | |
native int | fd () |
Returns the file descriptor if is_open(), otherwise -1 for no file descriptor. More... | |
IOState | rdState () |
Returns the current state flags. More... | |
void | setState (final IOState state) |
Sets state flags, by keeping its previous bits. More... | |
native boolean | good () |
Checks if no error nor eof() has occurred i.e. More... | |
native boolean | eof () |
Checks if end-of-file has been reached. More... | |
native boolean | fail () |
Checks if an error has occurred. More... | |
native boolean | bad () |
Checks if a non-recoverable error has occurred. More... | |
native boolean | timeout () |
Checks if a timeout (non-recoverable) has occurred. More... | |
native int | write (final byte[] in, final int offset, final int length) |
Write to the data sink. More... | |
int | write (final ByteBuffer in) |
Write to the data sink. More... | |
native String | id () |
return the id of this data source More... | |
native long | tellp () |
Returns the output position indicator. More... | |
native String | toString () |
boolean | is_open () |
Checks if the stream has an associated file. More... | |
void | closeStream () |
Close the stream if supported by the underlying mechanism. More... | |
void | close () |
Close the stream if supported by the underlying mechanism and dispose the native instance. More... | |
int | write (byte in[], final int offset, final int length) |
Write to the data sink. More... | |
int | write (ByteBuffer in) |
Write to the data sink. More... | |
String | id () |
return the id of this data source More... | |
long | tellp () |
Returns the output position indicator. More... | |
String | toString () |
void | clear (final IOState state) |
Clears state flags by assignment to the given value. More... | |
IOState | rdState () |
Returns the current state flags. More... | |
void | setState (final IOState state) |
Sets state flags, by keeping its previous bits. More... | |
boolean | good () |
Checks if no error nor eof() has occurred i.e. More... | |
boolean | eof () |
Checks if end-of-file has been reached. More... | |
boolean | fail () |
Checks if an error has occurred. More... | |
boolean | bad () |
Checks if a non-recoverable error has occurred. More... | |
boolean | timeout () |
Checks if a timeout (non-recoverable) has occurred. More... | |
File based byte output stream, including named file descriptor.
Implementation mimics std::ifstream via OS level file descriptor (FD) operations, giving more flexibility, allowing reusing existing FD and enabling openat() operations.
Instance uses the native C++ object jau::io::ByteOutStream_File
.
Definition at line 38 of file ByteOutStream_File.java.
org.jau.io.ByteOutStream_File.ByteOutStream_File | ( | final String | path, |
final FMode | mode | ||
) |
Construct a stream based byte output stream from filesystem path, either an existing or new file.
In case the file already exists, the underlying file offset is positioned at the end of the file.
In case the given path is a local file URI starting with file://
, see jau::io::uri::is_local_file_protocol(), the leading file://
is cut off and the remainder being used.
path | the path to the file, maybe a local file URI |
mode | file protection mode for a new file, otherwise ignored, may use FMode#def_file . |
Definition at line 54 of file ByteOutStream_File.java.
org.jau.io.ByteOutStream_File.ByteOutStream_File | ( | final int | dirfd, |
final String | path, | ||
final FMode | mode | ||
) |
Construct a stream based byte output stream from filesystem path and parent directory file descriptor, either an existing or new file.
In case the file already exists, the underlying file offset is positioned at the end of the file.
In case the given path is a local file URI starting with file://
, see jau::io::uri::is_local_file_protocol(), the leading file://
is cut off and the remainder being used.
dirfd | parent directory file descriptor |
path | the path to the file, maybe a local file URI |
mode | file protection mode for a new file, otherwise ignored, may use FMode#def_file . |
Definition at line 77 of file ByteOutStream_File.java.
org.jau.io.ByteOutStream_File.ByteOutStream_File | ( | final int | fd | ) |
Construct a stream based byte output stream by duplicating given file descriptor.
In case the given path is a local file URI starting with file://
, see jau::io::uri::is_local_file_protocol(), the leading file://
is cut off and the remainder being used.
fd | file descriptor to duplicate leaving the given fd untouched |
Definition at line 95 of file ByteOutStream_File.java.
native boolean org.jau.io.ByteOutStream_File.bad | ( | ) |
Checks if a non-recoverable error has occurred.
Implements org.jau.io.IOStateFunc.
void org.jau.io.ByteOutStream_File.clear | ( | final IOState | state | ) |
Clears state flags by assignment to the given value.
Implements org.jau.io.IOStateFunc.
Definition at line 130 of file ByteOutStream_File.java.
void org.jau.io.ByteOutStream_File.close | ( | ) |
Close the stream if supported by the underlying mechanism and dispose the native instance.
Instance is unusable after having this method called.
Close the stream if supported by the underlying mechanism and dispose the native instance.Instance is unusable after having this method called.
Implements org.jau.io.ByteOutStream.
Definition at line 109 of file ByteOutStream_File.java.
native void org.jau.io.ByteOutStream_File.closeStream | ( | ) |
Close the stream if supported by the underlying mechanism.
Native instance will not be disposed.
Close the stream if supported by the underlying mechanism.Native instance will not be disposed.
Implements org.jau.io.ByteOutStream.
native boolean org.jau.io.ByteOutStream_File.eof | ( | ) |
Checks if end-of-file has been reached.
Implements org.jau.io.IOStateFunc.
native boolean org.jau.io.ByteOutStream_File.fail | ( | ) |
Checks if an error has occurred.
Implements org.jau.io.IOStateFunc.
native int org.jau.io.ByteOutStream_File.fd | ( | ) |
void org.jau.io.ByteOutStream_File.finalize | ( | ) |
native boolean org.jau.io.ByteOutStream_File.good | ( | ) |
Checks if no error nor eof() has occurred i.e.
I/O operations are available.
Implements org.jau.io.IOStateFunc.
native String org.jau.io.ByteOutStream_File.id | ( | ) |
return the id of this data source
Implements org.jau.io.ByteOutStream.
native boolean org.jau.io.ByteOutStream_File.is_open | ( | ) |
Checks if the stream has an associated file.
Implements org.jau.io.ByteOutStream.
IOState org.jau.io.ByteOutStream_File.rdState | ( | ) |
Returns the current state flags.
Method is marked virtual
to allow implementations with asynchronous resources to determine or update the current iostate.
Method is used throughout all query members and setstate(), hence they all will use the updated state from a potential override implementation.
Implements org.jau.io.IOStateFunc.
Definition at line 143 of file ByteOutStream_File.java.
void org.jau.io.ByteOutStream_File.setState | ( | final IOState | state | ) |
Sets state flags, by keeping its previous bits.
Implements org.jau.io.IOStateFunc.
Definition at line 149 of file ByteOutStream_File.java.
native long org.jau.io.ByteOutStream_File.tellp | ( | ) |
Returns the output position indicator.
Implements org.jau.io.ByteOutStream.
native boolean org.jau.io.ByteOutStream_File.timeout | ( | ) |
Checks if a timeout (non-recoverable) has occurred.
Implements org.jau.io.IOStateFunc.
native String org.jau.io.ByteOutStream_File.toString | ( | ) |
native int org.jau.io.ByteOutStream_File.write | ( | final byte[] | in, |
final int | offset, | ||
final int | length | ||
) |
Write to the data sink.
Moves the internal offset so that every call to write will be appended to the sink.
This method is not blocking beyond the transfer length bytes.
in | the input bytes to write out |
offset | offset to byte array to write out |
length | the length of the byte array in |
Implements org.jau.io.ByteOutStream.
int org.jau.io.ByteOutStream_File.write | ( | final ByteBuffer | in | ) |
Write to the data sink.
Moves the internal offset so that every call to write will be appended to the sink.
This method is not blocking beyond the transfer length bytes.
in | the direct ByteBuffer source to be written to the sink from position up to its limit , i.e. remaining . Position will be set to position + written-bytes. |
position
- previous position
. Implements org.jau.io.ByteOutStream.
Definition at line 173 of file ByteOutStream_File.java.