Class DataOutputStream

All Implemented Interfaces:
AutoCloseable, Seekable, Proxy, AutoCloseable

@Generated("org.javagi.JavaGI") public class DataOutputStream extends FilterOutputStream implements Seekable
Data output stream implements OutputStream and includes functions for writing data directly to an output stream.
  • Constructor Details

    • DataOutputStream

      public DataOutputStream(MemorySegment address)
      Create a DataOutputStream instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • DataOutputStream

      public DataOutputStream(OutputStream baseStream)
      Creates a new data output stream for baseStream.
      Parameters:
      baseStream - a GOutputStream.
    • DataOutputStream

      public DataOutputStream()
      Create a new DataOutputStream.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the DataOutputStream class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected DataOutputStream asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class FilterOutputStream
      Returns:
      the instance as if it were its parent type
    • getByteOrder

      public DataStreamByteOrder getByteOrder()
      Gets the byte order for the stream.
      Returns:
      the GDataStreamByteOrder for the stream.
    • putByte

      public boolean putByte(byte data, @Nullable Cancellable cancellable) throws GErrorException
      Puts a byte into the output stream.
      Parameters:
      data - a guchar.
      cancellable - optional GCancellable object, null to ignore.
      Returns:
      true if data was successfully added to the stream.
      Throws:
      GErrorException - see GError
    • putInt16

      public boolean putInt16(short data, @Nullable Cancellable cancellable) throws GErrorException
      Puts a signed 16-bit integer into the output stream.
      Parameters:
      data - a gint16.
      cancellable - optional GCancellable object, null to ignore.
      Returns:
      true if data was successfully added to the stream.
      Throws:
      GErrorException - see GError
    • putInt32

      public boolean putInt32(int data, @Nullable Cancellable cancellable) throws GErrorException
      Puts a signed 32-bit integer into the output stream.
      Parameters:
      data - a gint32.
      cancellable - optional GCancellable object, null to ignore.
      Returns:
      true if data was successfully added to the stream.
      Throws:
      GErrorException - see GError
    • putInt64

      public boolean putInt64(long data, @Nullable Cancellable cancellable) throws GErrorException
      Puts a signed 64-bit integer into the stream.
      Parameters:
      data - a gint64.
      cancellable - optional GCancellable object, null to ignore.
      Returns:
      true if data was successfully added to the stream.
      Throws:
      GErrorException - see GError
    • putString

      public boolean putString(String str, @Nullable Cancellable cancellable) throws GErrorException
      Puts a string into the output stream.
      Parameters:
      str - a string.
      cancellable - optional GCancellable object, null to ignore.
      Returns:
      true if string was successfully added to the stream.
      Throws:
      GErrorException - see GError
    • putUint16

      public boolean putUint16(short data, @Nullable Cancellable cancellable) throws GErrorException
      Puts an unsigned 16-bit integer into the output stream.
      Parameters:
      data - a guint16.
      cancellable - optional GCancellable object, null to ignore.
      Returns:
      true if data was successfully added to the stream.
      Throws:
      GErrorException - see GError
    • putUint32

      public boolean putUint32(int data, @Nullable Cancellable cancellable) throws GErrorException
      Puts an unsigned 32-bit integer into the stream.
      Parameters:
      data - a guint32.
      cancellable - optional GCancellable object, null to ignore.
      Returns:
      true if data was successfully added to the stream.
      Throws:
      GErrorException - see GError
    • putUint64

      public boolean putUint64(long data, @Nullable Cancellable cancellable) throws GErrorException
      Puts an unsigned 64-bit integer into the stream.
      Parameters:
      data - a guint64.
      cancellable - optional GCancellable object, null to ignore.
      Returns:
      true if data was successfully added to the stream.
      Throws:
      GErrorException - see GError
    • setByteOrder

      public void setByteOrder(DataStreamByteOrder order)
      Sets the byte order of the data output stream to order.
      Parameters:
      order - a GDataStreamByteOrder.
    • builder

      public static DataOutputStream.Builder<? extends DataOutputStream.Builder> builder()
      A DataOutputStream.Builder object constructs a DataOutputStream with the specified properties. Use the various set...() methods to set properties, and finish construction with DataOutputStream.Builder.build().
      Returns:
      the builder object