gioutil

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2024 License: MPL-2.0, ISC Imports: 13 Imported by: 9

Documentation

Overview

Package gioutil provides wrappers around certain GIO classes to be more Go idiomatic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InputCloser

func InputCloser(ctx context.Context, input gio.InputStreamer) io.Closer

InputCloser wraps an InputStreamer and returns an io.Closer.

func NewInputStream

func NewInputStream(r io.Reader) *gio.InputStream

NewInputStream creates a new InputStream for the given io.Reader. If r implements io.Closer, then it is automatically called if needed.

func NewOutputStream

func NewOutputStream(w io.Writer) *gio.OutputStream

NewOutputStream creates a new OutputStream for the given io.Reader. If r implements io.Closer, then it is automatically called if needed.

func OutputCloser

func OutputCloser(ctx context.Context, output gio.OutputStreamer) io.Closer

OutputCloser wraps an OutputStreamer and returns an io.Closer.

func PixbufLoaderWriter

func PixbufLoaderWriter(l *gdkpixbuf.PixbufLoader) io.WriteCloser

PixbufLoaderWriter wraps a PixbufLoader to satsify io.WriteCloser.

func ReadCloser

func ReadCloser(r io.Reader, c io.Closer) io.ReadCloser

ReadCloser combines the reader and closer together.

func Seeker

func Seeker(ctx context.Context, s gio.Seekabler) io.Seeker

Seeker wraps around a gio.Seekable.

Types

type StreamReader

type StreamReader struct {
	// contains filtered or unexported fields
}

StreamReader wraps around a gio.InputStreamer.

func Reader

func Reader(ctx context.Context, s gio.InputStreamer) *StreamReader

Reader wraps a gio.InputStreamer to provide an io.ReadCloser. The given context allows the caller to cancel all ongoing operations done on the new ReadCloser.

func (*StreamReader) Close

func (r *StreamReader) Close() error

Close implements io.Closer.

func (*StreamReader) Read

func (r *StreamReader) Read(b []byte) (int, error)

Read implements io.Reader.

type StreamWriter

type StreamWriter struct {
	// contains filtered or unexported fields
}

StreamWriter wraps around a gio.OutputStreamer.

func Writer

func Writer(ctx context.Context, s gio.OutputStreamer) *StreamWriter

Writer wraps a gio.OutputStreamer to provide an io.WriteCloser with flushing capability.

func (*StreamWriter) Close

func (w *StreamWriter) Close() error

Close implements io.Closer.

func (*StreamWriter) Flush

func (w *StreamWriter) Flush() error

Flush flushes the writer. See gio.OutputStreamer.Flush.

func (*StreamWriter) ReadFrom

func (w *StreamWriter) ReadFrom(r io.Reader) (int64, error)

ReadFrom implements io.ReaderFrom. It has a fast path for gio.InputStreamers wrapped using gioutil.Reader.

func (*StreamWriter) Write

func (w *StreamWriter) Write(b []byte) (int, error)

Write implements io.Writer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL