Class FileInputStream

All Implemented Interfaces:
AutoCloseable, Seekable, Proxy, AutoCloseable

@Generated("org.javagi.JavaGI") public class FileInputStream extends InputStream implements Seekable

GFileInputStream provides input streams that take their content from a file.

GFileInputStream implements Seekable, which allows the input stream to jump to arbitrary positions in the file, provided the filesystem of the file allows it. To find the position of a file input stream, use Seekable.tell(). To find out if a file input stream supports seeking, use Seekable.canSeek(). To position a file input stream, use Seekable.seek(long, SeekType, Cancellable).

  • Constructor Details

    • FileInputStream

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

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

    • getType

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

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

      protected FileInputStream 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 InputStream
      Returns:
      the instance as if it were its parent type
    • queryInfo

      public FileInfo queryInfo(String attributes, @Nullable Cancellable cancellable) throws GErrorException
      Queries a file input stream the given attributes. This function blocks while querying the stream. For the asynchronous (non-blocking) version of this function, see g_file_input_stream_query_info_async(). While the stream is blocked, the stream will set the pending flag internally, and any other operations on the stream will fail with IOErrorEnum.PENDING.
      Parameters:
      attributes - a file attribute query string.
      cancellable - optional GCancellable object, null to ignore.
      Returns:
      a GFileInfo, or null on error.
      Throws:
      GErrorException - see GError
    • queryInfoAsync

      public void queryInfoAsync(String attributes, int ioPriority, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback)

      Queries the stream information asynchronously. When the operation is finished callback will be called. You can then call g_file_input_stream_query_info_finish() to get the result of the operation.

      For the synchronous version of this function, see g_file_input_stream_query_info().

      If cancellable is not null, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IOErrorEnum.CANCELLED will be set

      Parameters:
      attributes - a file attribute query string.
      ioPriority - the I/O priority of the request
      cancellable - optional GCancellable object, null to ignore.
      callback - a GAsyncReadyCallback to call when the request is satisfied
    • queryInfoFinish

      public FileInfo queryInfoFinish(AsyncResult result) throws GErrorException
      Finishes an asynchronous info query operation.
      Parameters:
      result - a GAsyncResult.
      Returns:
      GFileInfo.
      Throws:
      GErrorException - see GError
    • builder

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