jaulib v1.5.0
Jau Support Library (C++, Java, ..)
Loading...
Searching...
No Matches
org.jau.io.ByteOutStream Interface Reference

Abstract byte output stream object, to write data to a sink. More...

Inheritance diagram for org.jau.io.ByteOutStream:
Collaboration diagram for org.jau.io.ByteOutStream:

Public Member Functions

void close ()
 Close the stream if supported by the underlying mechanism and dispose the native instance.
 
void closeStream ()
 Close the stream if supported by the underlying mechanism.
 
String id ()
 return the id of this data source
 
boolean is_open ()
 Checks if the stream has an associated file.
 
long position ()
 Returns the output position indicator.
 
String toString ()
 
int write (byte in[], final int offset, final int length)
 Write to the data sink.
 
int write (ByteBuffer in)
 Write to the data sink.
 
- Public Member Functions inherited from org.jau.io.IOStateFunc
boolean bad ()
 Checks if a non-recoverable error has occurred.
 
void clear (final IOState state)
 Clears state flags by assignment to the given value.
 
boolean eof ()
 Checks if end-of-file has been reached.
 
boolean fail ()
 Checks if an error has occurred.
 
boolean good ()
 Checks if no error nor eof() has occurred i.e.
 
IOState rdState ()
 Returns the current state flags.
 
void setState (final IOState state)
 Sets state flags, by keeping its previous bits.
 
boolean timeout ()
 Checks if a timeout (non-recoverable) has occurred.
 

Detailed Description

Abstract byte output stream object, to write data to a sink.

Its specializations utilize a native C++ implementation derived from jau.io.ByteOutStream.

All method implementations are of noexcept.

One may use fail() to detect whether an error has occurred.

Definition at line 39 of file ByteOutStream.java.

Member Function Documentation

◆ is_open()

boolean org.jau.io.ByteOutStream.is_open ( )

Checks if the stream has an associated file.

Implemented in org.jau.io.ByteOutStream_File.

◆ closeStream()

void org.jau.io.ByteOutStream.closeStream ( )

Close the stream if supported by the underlying mechanism.

Native instance will not be disposed.

Implemented in org.jau.io.ByteOutStream_File.

◆ close()

void org.jau.io.ByteOutStream.close ( )

Close the stream if supported by the underlying mechanism and dispose the native instance.

Instance is unusable after having this method called.

Implemented in org.jau.io.ByteOutStream_File.

◆ write() [1/2]

int org.jau.io.ByteOutStream.write ( 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.

Parameters
inthe input bytes to write out
offsetoffset to byte array to write out
lengththe length of the byte array in
Returns
length in bytes that were actually written

Implemented in org.jau.io.ByteOutStream_File.

◆ write() [2/2]

int org.jau.io.ByteOutStream.write ( 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.

Parameters
inthe 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.
Returns
length in bytes that were actually written, equal to its current position - previous position.

Implemented in org.jau.io.ByteOutStream_File.

◆ id()

String org.jau.io.ByteOutStream.id ( )

return the id of this data source

Returns
std::string representing the id of this data source

Implemented in org.jau.io.ByteOutStream_File.

◆ position()

long org.jau.io.ByteOutStream.position ( )

Returns the output position indicator.

Returns
number of bytes written so far.

Implemented in org.jau.io.ByteOutStream_File.

◆ toString()

String org.jau.io.ByteOutStream.toString ( )

The documentation for this interface was generated from the following file: