jaulib v1.3.0
Jau Support Library (C++, Java, ..)
Public Member Functions | List of all members
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

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 ()
 
- Public Member Functions inherited from org.jau.io.IOStateFunc
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...
 

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

◆ 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.

◆ 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.

◆ 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.

◆ is_open()

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

Checks if the stream has an associated file.

Implemented in org.jau.io.ByteOutStream_File.

◆ tellp()

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

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 ( )

◆ 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.


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