| Copyright | Will Thompson and Iñaki García Etxebarria |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria |
| Safe Haskell | None |
| Language | Haskell2010 |
GI.GLib.Structs.IOChannel
Contents
- Exported types
- Methods
- close
- errorFromErrno
- errorQuark
- flush
- getBufferCondition
- getBufferSize
- getBuffered
- getCloseOnUnref
- getEncoding
- getFlags
- getLineTerm
- init
- newFile
- read
- readChars
- readLine
- readToEnd
- readUnichar
- ref
- seek
- seekPosition
- setBufferSize
- setBuffered
- setCloseOnUnref
- setEncoding
- setFlags
- setLineTerm
- shutdown
- unixGetFd
- unixNew
- unref
- write
- writeChars
- writeUnichar
Description
The GIOChannel data type aims to provide a portable method for
using file descriptors, pipes, and sockets, and integrating them
into the main event loop (see MainContext). Currently,
full support is available on UNIX platforms; support for Windows
is only partially complete.
To create a new GIOChannel on UNIX systems use
iOChannelUnixNew. This works for plain file descriptors,
pipes and sockets. Alternatively, a channel can be created for a
file in a system independent manner using iOChannelNewFile.
Once a GIOChannel has been created, it can be used in a generic
manner with the functions iOChannelReadChars,
iOChannelWriteChars, iOChannelSeekPosition,
and iOChannelShutdown.
To add a GIOChannel to the main event loop, use ioAddWatch or
GLib.io_add_watch_full. Here you specify which events you are
interested in on the GIOChannel, and provide a function to be called
whenever these events occur.
GIOChannel instances are created with an initial reference count of 1.
iOChannelRef and iOChannelUnref can be used to
increment or decrement the reference count respectively. When the
reference count falls to 0, the GIOChannel is freed. (Though it
isn’t closed automatically, unless it was created using
iOChannelNewFile.) Using ioAddWatch or
GLib.io_add_watch_full increments a channel’s reference count.
The new functions iOChannelReadChars,
iOChannelReadLine, IOChannel.read_line_string(),
iOChannelReadToEnd, iOChannelWriteChars,
iOChannelSeekPosition, and iOChannelFlush
should not be mixed with the deprecated functions
iOChannelRead, iOChannelWrite, and
iOChannelSeek on the same channel.
Synopsis
- newtype IOChannel = IOChannel (ManagedPtr IOChannel)
- newZeroIOChannel :: MonadIO m => m IOChannel
- type family ResolveIOChannelMethod (t :: Symbol) o where ...
- data IOChannelCloseMethodInfo
- iOChannelClose :: (HasCallStack, MonadIO m) => IOChannel -> m ()
- iOChannelErrorFromErrno :: (HasCallStack, MonadIO m) => Int32 -> m IOChannelError
- iOChannelErrorQuark :: (HasCallStack, MonadIO m) => m Word32
- data IOChannelFlushMethodInfo
- iOChannelFlush :: (HasCallStack, MonadIO m) => IOChannel -> m IOStatus
- data IOChannelGetBufferConditionMethodInfo
- iOChannelGetBufferCondition :: (HasCallStack, MonadIO m) => IOChannel -> m [IOCondition]
- data IOChannelGetBufferSizeMethodInfo
- iOChannelGetBufferSize :: (HasCallStack, MonadIO m) => IOChannel -> m CSize
- data IOChannelGetBufferedMethodInfo
- iOChannelGetBuffered :: (HasCallStack, MonadIO m) => IOChannel -> m Bool
- data IOChannelGetCloseOnUnrefMethodInfo
- iOChannelGetCloseOnUnref :: (HasCallStack, MonadIO m) => IOChannel -> m Bool
- data IOChannelGetEncodingMethodInfo
- iOChannelGetEncoding :: (HasCallStack, MonadIO m) => IOChannel -> m Text
- data IOChannelGetFlagsMethodInfo
- iOChannelGetFlags :: (HasCallStack, MonadIO m) => IOChannel -> m [IOFlags]
- data IOChannelGetLineTermMethodInfo
- iOChannelGetLineTerm :: (HasCallStack, MonadIO m) => IOChannel -> m (Text, Int32)
- data IOChannelInitMethodInfo
- iOChannelInit :: (HasCallStack, MonadIO m) => IOChannel -> m ()
- iOChannelNewFile :: (HasCallStack, MonadIO m) => [Char] -> Text -> m IOChannel
- data IOChannelReadMethodInfo
- iOChannelRead :: (HasCallStack, MonadIO m) => IOChannel -> Text -> CSize -> CSize -> m IOError
- data IOChannelReadCharsMethodInfo
- iOChannelReadChars :: (HasCallStack, MonadIO m) => IOChannel -> ByteString -> m (IOStatus, ByteString, CSize)
- data IOChannelReadLineMethodInfo
- iOChannelReadLine :: (HasCallStack, MonadIO m) => IOChannel -> m (IOStatus, Text, CSize, CSize)
- data IOChannelReadToEndMethodInfo
- iOChannelReadToEnd :: (HasCallStack, MonadIO m) => IOChannel -> m (IOStatus, ByteString)
- data IOChannelReadUnicharMethodInfo
- iOChannelReadUnichar :: (HasCallStack, MonadIO m) => IOChannel -> m (IOStatus, Char)
- data IOChannelRefMethodInfo
- iOChannelRef :: (HasCallStack, MonadIO m) => IOChannel -> m IOChannel
- data IOChannelSeekMethodInfo
- iOChannelSeek :: (HasCallStack, MonadIO m) => IOChannel -> Int64 -> SeekType -> m IOError
- data IOChannelSeekPositionMethodInfo
- iOChannelSeekPosition :: (HasCallStack, MonadIO m) => IOChannel -> Int64 -> SeekType -> m IOStatus
- data IOChannelSetBufferSizeMethodInfo
- iOChannelSetBufferSize :: (HasCallStack, MonadIO m) => IOChannel -> CSize -> m ()
- data IOChannelSetBufferedMethodInfo
- iOChannelSetBuffered :: (HasCallStack, MonadIO m) => IOChannel -> Bool -> m ()
- data IOChannelSetCloseOnUnrefMethodInfo
- iOChannelSetCloseOnUnref :: (HasCallStack, MonadIO m) => IOChannel -> Bool -> m ()
- data IOChannelSetEncodingMethodInfo
- iOChannelSetEncoding :: (HasCallStack, MonadIO m) => IOChannel -> Maybe Text -> m IOStatus
- data IOChannelSetFlagsMethodInfo
- iOChannelSetFlags :: (HasCallStack, MonadIO m) => IOChannel -> [IOFlags] -> m IOStatus
- data IOChannelSetLineTermMethodInfo
- iOChannelSetLineTerm :: (HasCallStack, MonadIO m) => IOChannel -> Maybe Text -> Int32 -> m ()
- data IOChannelShutdownMethodInfo
- iOChannelShutdown :: (HasCallStack, MonadIO m) => IOChannel -> Bool -> m IOStatus
- data IOChannelUnixGetFdMethodInfo
- iOChannelUnixGetFd :: (HasCallStack, MonadIO m) => IOChannel -> m Int32
- iOChannelUnixNew :: (HasCallStack, MonadIO m) => Int32 -> m IOChannel
- data IOChannelUnrefMethodInfo
- iOChannelUnref :: (HasCallStack, MonadIO m) => IOChannel -> m ()
- data IOChannelWriteMethodInfo
- iOChannelWrite :: (HasCallStack, MonadIO m) => IOChannel -> Text -> CSize -> CSize -> m IOError
- data IOChannelWriteCharsMethodInfo
- iOChannelWriteChars :: (HasCallStack, MonadIO m) => IOChannel -> Ptr Word8 -> Int64 -> m (IOStatus, CSize)
- data IOChannelWriteUnicharMethodInfo
- iOChannelWriteUnichar :: (HasCallStack, MonadIO m) => IOChannel -> Char -> m IOStatus
Exported types
Memory-managed wrapper type.
Constructors
| IOChannel (ManagedPtr IOChannel) |
Instances
newZeroIOChannel :: MonadIO m => m IOChannel Source #
Construct a IOChannel struct initialized to zero.
Methods
Click to display all available methods, including inherited ones
Methods
close, flush, init, read, readChars, readLine, readToEnd, readUnichar, ref, seek, seekPosition, shutdown, unixGetFd, unref, write, writeChars, writeUnichar.
Getters
getBufferCondition, getBufferSize, getBuffered, getCloseOnUnref, getEncoding, getFlags, getLineTerm.
Setters
setBufferSize, setBuffered, setCloseOnUnref, setEncoding, setFlags, setLineTerm.
type family ResolveIOChannelMethod (t :: Symbol) o where ... Source #
Equations
close
data IOChannelCloseMethodInfo Source #
Instances
| (signature ~ m (), MonadIO m) => OverloadedMethod IOChannelCloseMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelCloseMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => IOChannel |
|
| -> m () |
Deprecated: (Since version 2.2)Use iOChannelShutdown instead.
Close an IO channel. Any pending data to be written will be
flushed, ignoring errors. The channel will not be freed until the
last reference is dropped using iOChannelUnref.
errorFromErrno
iOChannelErrorFromErrno Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Int32 |
|
| -> m IOChannelError | Returns: a |
Converts an errno error number to a IOChannelError.
errorQuark
iOChannelErrorQuark :: (HasCallStack, MonadIO m) => m Word32 Source #
No description available in the introspection data.
flush
data IOChannelFlushMethodInfo Source #
Instances
| (signature ~ m IOStatus, MonadIO m) => OverloadedMethod IOChannelFlushMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelFlushMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => IOChannel |
|
| -> m IOStatus | Returns: the status of the operation: One of
|
Flushes the write buffer for the GIOChannel.
getBufferCondition
data IOChannelGetBufferConditionMethodInfo Source #
Instances
| (signature ~ m [IOCondition], MonadIO m) => OverloadedMethod IOChannelGetBufferConditionMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelGetBufferConditionMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |
iOChannelGetBufferCondition Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => IOChannel |
|
| -> m [IOCondition] | Returns: A |
This function returns a IOCondition depending on whether there
is data to be read/space to write data in the internal buffers in
the IOChannel. Only the flags IOConditionIn and IOConditionOut may be set.
getBufferSize
data IOChannelGetBufferSizeMethodInfo Source #
Instances
| (signature ~ m CSize, MonadIO m) => OverloadedMethod IOChannelGetBufferSizeMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelGetBufferSizeMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |
iOChannelGetBufferSize Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => IOChannel |
|
| -> m CSize | Returns: the size of the buffer. |
Gets the buffer size.
getBuffered
data IOChannelGetBufferedMethodInfo Source #
Instances
| (signature ~ m Bool, MonadIO m) => OverloadedMethod IOChannelGetBufferedMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelGetBufferedMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => IOChannel |
|
| -> m Bool | Returns: |
Returns whether channel is buffered.
getCloseOnUnref
data IOChannelGetCloseOnUnrefMethodInfo Source #
Instances
| (signature ~ m Bool, MonadIO m) => OverloadedMethod IOChannelGetCloseOnUnrefMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelGetCloseOnUnrefMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |
getEncoding
data IOChannelGetEncodingMethodInfo Source #
Instances
| (signature ~ m Text, MonadIO m) => OverloadedMethod IOChannelGetEncodingMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelGetEncodingMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => IOChannel |
|
| -> m Text | Returns: A string containing the encoding, this string is owned by GLib and must not be freed. |
Gets the encoding for the input/output of the channel.
The internal encoding is always UTF-8. The encoding Nothing
makes the channel safe for binary data.
getFlags
data IOChannelGetFlagsMethodInfo Source #
Instances
| (signature ~ m [IOFlags], MonadIO m) => OverloadedMethod IOChannelGetFlagsMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelGetFlagsMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => IOChannel |
|
| -> m [IOFlags] | Returns: the flags which are set on the channel |
Gets the current flags for a IOChannel, including read-only
flags such as IOFlagsIsReadable.
The values of the flags IOFlagsIsReadable and IOFlagsIsWritable
are cached for internal use by the channel when it is created.
If they should change at some later point (e.g. partial shutdown
of a socket with the UNIX shutdown() function), the user
should immediately call iOChannelGetFlags to update
the internal values of these flags.
getLineTerm
data IOChannelGetLineTermMethodInfo Source #
Instances
| (signature ~ m (Text, Int32), MonadIO m) => OverloadedMethod IOChannelGetLineTermMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelGetLineTermMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |
init
data IOChannelInitMethodInfo Source #
Instances
| (signature ~ m (), MonadIO m) => OverloadedMethod IOChannelInitMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelInitMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => IOChannel |
|
| -> m () |
newFile
Arguments
| :: (HasCallStack, MonadIO m) | |
| => [Char] |
|
| -> Text |
|
| -> m IOChannel | Returns: A |
Open a file filename as a IOChannel using mode mode. This
channel will be closed when the last reference to it is dropped,
so there is no need to call iOChannelClose (though doing
so will not cause problems, as long as no attempt is made to
access the channel after it is closed).
read
data IOChannelReadMethodInfo Source #
Instances
| (signature ~ (Text -> CSize -> CSize -> m IOError), MonadIO m) => OverloadedMethod IOChannelReadMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelReadMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => IOChannel |
|
| -> Text |
|
| -> CSize |
|
| -> CSize |
|
| -> m IOError | Returns: |
Deprecated: (Since version 2.2)Use iOChannelReadChars instead.
Reads data from a IOChannel.
readChars
data IOChannelReadCharsMethodInfo Source #
Instances
| (signature ~ (ByteString -> m (IOStatus, ByteString, CSize)), MonadIO m) => OverloadedMethod IOChannelReadCharsMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelReadCharsMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => IOChannel |
|
| -> ByteString |
|
| -> m (IOStatus, ByteString, CSize) | Returns: the status of the operation. (Can throw |
Replacement for iOChannelRead with the new API.
readLine
data IOChannelReadLineMethodInfo Source #
Instances
| (signature ~ m (IOStatus, Text, CSize, CSize), MonadIO m) => OverloadedMethod IOChannelReadLineMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelReadLineMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => IOChannel |
|
| -> m (IOStatus, Text, CSize, CSize) | Returns: the status of the operation. (Can throw |
Reads a line, including the terminating character(s),
from a IOChannel into a newly-allocated string.
strReturn will contain allocated memory if the return
is IOStatusNormal.
readToEnd
data IOChannelReadToEndMethodInfo Source #
Instances
| (signature ~ m (IOStatus, ByteString), MonadIO m) => OverloadedMethod IOChannelReadToEndMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelReadToEndMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => IOChannel |
|
| -> m (IOStatus, ByteString) | Returns: |
Reads all the remaining data from the file.
readUnichar
data IOChannelReadUnicharMethodInfo Source #
Instances
| (signature ~ m (IOStatus, Char), MonadIO m) => OverloadedMethod IOChannelReadUnicharMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelReadUnicharMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |
Reads a Unicode character from channel.
This function cannot be called on a channel with Nothing encoding.
ref
data IOChannelRefMethodInfo Source #
Instances
| (signature ~ m IOChannel, MonadIO m) => OverloadedMethod IOChannelRefMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelRefMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => IOChannel |
|
| -> m IOChannel | Returns: the |
Increments the reference count of a IOChannel.
seek
data IOChannelSeekMethodInfo Source #
Instances
| (signature ~ (Int64 -> SeekType -> m IOError), MonadIO m) => OverloadedMethod IOChannelSeekMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelSeekMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => IOChannel |
|
| -> Int64 |
|
| -> SeekType |
|
| -> m IOError | Returns: |
Deprecated: (Since version 2.2)Use iOChannelSeekPosition instead.
Sets the current position in the IOChannel, similar to the standard
library function fseek().
seekPosition
data IOChannelSeekPositionMethodInfo Source #
Instances
| (signature ~ (Int64 -> SeekType -> m IOStatus), MonadIO m) => OverloadedMethod IOChannelSeekPositionMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelSeekPositionMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |
iOChannelSeekPosition Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => IOChannel |
|
| -> Int64 |
|
| -> SeekType |
|
| -> m IOStatus | Returns: the status of the operation. (Can throw |
Replacement for iOChannelSeek with the new API.
setBufferSize
data IOChannelSetBufferSizeMethodInfo Source #
Instances
| (signature ~ (CSize -> m ()), MonadIO m) => OverloadedMethod IOChannelSetBufferSizeMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelSetBufferSizeMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |
iOChannelSetBufferSize Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => IOChannel |
|
| -> CSize |
|
| -> m () |
Sets the buffer size.
setBuffered
data IOChannelSetBufferedMethodInfo Source #
Instances
| (signature ~ (Bool -> m ()), MonadIO m) => OverloadedMethod IOChannelSetBufferedMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelSetBufferedMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => IOChannel |
|
| -> Bool |
|
| -> m () |
The buffering state can only be set if the channel's encoding
is Nothing. For any other encoding, the channel must be buffered.
A buffered channel can only be set unbuffered if the channel's
internal buffers have been flushed. Newly created channels or
channels which have returned IOStatusEof
not require such a flush. For write-only channels, a call to
g_io_channel_flush () is sufficient. For all other channels,
the buffers may be flushed by a call to g_io_channel_seek_position ().
This includes the possibility of seeking with seek type SeekTypeCur
and an offset of zero. Note that this means that socket-based
channels cannot be set unbuffered once they have had data
read from them.
On unbuffered channels, it is safe to mix read and write calls from the new and old APIs, if this is necessary for maintaining old code.
The default state of the channel is buffered.
setCloseOnUnref
data IOChannelSetCloseOnUnrefMethodInfo Source #
Instances
| (signature ~ (Bool -> m ()), MonadIO m) => OverloadedMethod IOChannelSetCloseOnUnrefMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelSetCloseOnUnrefMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |
iOChannelSetCloseOnUnref Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => IOChannel |
|
| -> Bool |
|
| -> m () |
Whether to close the channel on the final unref of the IOChannel
data structure. The default value of this is True for channels
created by g_io_channel_new_file (), and False for all other channels.
Setting this flag to True for a channel you have already closed
can cause problems when the final reference to the IOChannel is dropped.
setEncoding
data IOChannelSetEncodingMethodInfo Source #
Instances
| (signature ~ (Maybe Text -> m IOStatus), MonadIO m) => OverloadedMethod IOChannelSetEncodingMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelSetEncodingMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => IOChannel |
|
| -> Maybe Text |
|
| -> m IOStatus | Returns: |
Sets the encoding for the input/output of the channel. The internal encoding is always UTF-8. The default encoding for the external file is UTF-8.
The encoding Nothing is safe to use with binary data.
The encoding can only be set if one of the following conditions is true:
- The channel was just created, and has not been written to or read from yet.
- The channel is write-only.
- The channel is a file, and the file pointer was just repositioned
by a call to
iOChannelSeekPosition. (This flushes all the internal buffers.) - The current encoding is
Nothingor UTF-8. - One of the (new API) read functions has just returned
IOStatusEof(or, in the case ofiOChannelReadToEnd,IOStatusNormal). - One of the functions
iOChannelReadCharsoriOChannelReadUnicharhas returnedIOStatusAgainorIOStatusError. This may be useful in the case ofConvertErrorIllegalSequence. Returning one of these statuses fromiOChannelReadLine,g_io_channel_read_line_string(), oriOChannelReadToEnddoes not guarantee that the encoding can be changed.
Channels which do not meet one of the above conditions cannot call
iOChannelSeekPosition with an offset of SeekTypeCur, and, if
they are "seekable", cannot call iOChannelWriteChars after
calling one of the API "read" functions.
setFlags
data IOChannelSetFlagsMethodInfo Source #
Instances
| (signature ~ ([IOFlags] -> m IOStatus), MonadIO m) => OverloadedMethod IOChannelSetFlagsMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelSetFlagsMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => IOChannel |
|
| -> [IOFlags] |
|
| -> m IOStatus | Returns: the status of the operation. (Can throw |
Sets the (writeable) flags in channel to (flags & IOFlagsSetMask).
setLineTerm
data IOChannelSetLineTermMethodInfo Source #
Instances
| (signature ~ (Maybe Text -> Int32 -> m ()), MonadIO m) => OverloadedMethod IOChannelSetLineTermMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelSetLineTermMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => IOChannel |
|
| -> Maybe Text |
|
| -> Int32 |
|
| -> m () |
This sets the string that IOChannel uses to determine
where in the file a line break occurs.
shutdown
data IOChannelShutdownMethodInfo Source #
Instances
| (signature ~ (Bool -> m IOStatus), MonadIO m) => OverloadedMethod IOChannelShutdownMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelShutdownMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => IOChannel |
|
| -> Bool |
|
| -> m IOStatus | Returns: the status of the operation. (Can throw |
Close an IO channel. Any pending data to be written will be
flushed if flush is True. The channel will not be freed until the
last reference is dropped using iOChannelUnref.
unixGetFd
data IOChannelUnixGetFdMethodInfo Source #
Instances
| (signature ~ m Int32, MonadIO m) => OverloadedMethod IOChannelUnixGetFdMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelUnixGetFdMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => IOChannel |
|
| -> m Int32 | Returns: the file descriptor of the |
unixNew
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Int32 |
|
| -> m IOChannel | Returns: a new |
Creates a new IOChannel given a file descriptor. On UNIX systems
this works for plain files, pipes, and sockets.
The returned IOChannel has a reference count of 1.
The default encoding for IOChannel is UTF-8. If your application
is reading output from a command using via pipe, you may need to set
the encoding to the encoding of the current locale (see
getCharset) with the iOChannelSetEncoding function.
By default, the fd passed will not be closed when the final reference
to the IOChannel data structure is dropped.
If you want to read raw binary data without interpretation, then
call the iOChannelSetEncoding function with Nothing for the
encoding argument.
This function is available in GLib on Windows, too, but you should avoid using it on Windows. The domain of file descriptors and sockets overlap. There is no way for GLib to know which one you mean in case the argument you pass to this function happens to be both a valid file descriptor and socket. If that happens a warning is issued, and GLib assumes that it is the file descriptor you mean.
unref
data IOChannelUnrefMethodInfo Source #
Instances
| (signature ~ m (), MonadIO m) => OverloadedMethod IOChannelUnrefMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelUnrefMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => IOChannel |
|
| -> m () |
Decrements the reference count of a IOChannel.
write
data IOChannelWriteMethodInfo Source #
Instances
| (signature ~ (Text -> CSize -> CSize -> m IOError), MonadIO m) => OverloadedMethod IOChannelWriteMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelWriteMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => IOChannel |
|
| -> Text |
|
| -> CSize |
|
| -> CSize |
|
| -> m IOError | Returns: |
Deprecated: (Since version 2.2)Use iOChannelWriteChars instead.
Writes data to a IOChannel.
writeChars
data IOChannelWriteCharsMethodInfo Source #
Instances
| (signature ~ (Ptr Word8 -> Int64 -> m (IOStatus, CSize)), MonadIO m) => OverloadedMethod IOChannelWriteCharsMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelWriteCharsMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => IOChannel |
|
| -> Ptr Word8 |
|
| -> Int64 |
|
| -> m (IOStatus, CSize) | Returns: the status of the operation. (Can throw |
Replacement for iOChannelWrite with the new API.
On seekable channels with encodings other than Nothing or UTF-8, generic
mixing of reading and writing is not allowed. A call to g_io_channel_write_chars ()
may only be made on a channel from which data has been read in the
cases described in the documentation for g_io_channel_set_encoding ().
writeUnichar
data IOChannelWriteUnicharMethodInfo Source #
Instances
| (signature ~ (Char -> m IOStatus), MonadIO m) => OverloadedMethod IOChannelWriteUnicharMethodInfo IOChannel signature Source # | |
Defined in GI.GLib.Structs.IOChannel Methods overloadedMethod :: IOChannel -> signature # | |
| OverloadedMethodInfo IOChannelWriteUnicharMethodInfo IOChannel Source # | |
Defined in GI.GLib.Structs.IOChannel Methods | |