Movatterモバイル変換


[0]ホーム

URL:


base-4.12.0.0: Basic libraries

Copyright(c) The University of Glasgow 2008
Licensesee libraries/base/LICENSE
Maintainercvs-ghc@haskell.org
Stabilityinternal
Portabilitynon-portable (GHC Extensions)
Safe HaskellTrustworthy
LanguageHaskell2010

GHC.IO.Buffer

Contents

Description

Buffers used in the IO system

Synopsis

Buffers of any element

dataBuffer eSource#

A mutable array of bytes that can be passed to foreign functions.

The buffer is represented by a record, where the record contains the raw buffer and the start/end points of the filled portion. The buffer contents itself is mutable, but the rest of the record is immutable. This is a slightly odd mix, but it turns out to be quite practical: by making all the buffer metadata immutable, we can have operations on buffer metadata outside of the IO monad.

The "live" elements of the buffer are those between thebufL andbufR offsets. In an empty buffer,bufL is equal tobufR, but they might not be zero: for example, the buffer might correspond to a memory-mapped file and in which casebufL will point to the next location to be written, which is not necessarily the beginning of the file.

Constructors

Buffer 

Fields

dataBufferStateSource#

Constructors

ReadBuffer 
WriteBuffer 
Instances
EqBufferStateSource#

Since: 4.2.0.0

Instance details

Defined inGHC.IO.Buffer

typeCharBuffer =BufferCharSource#

typeCharBufElem =CharSource#

Creation

newByteBuffer ::Int ->BufferState ->IO (BufferWord8)Source#

newCharBuffer ::Int ->BufferState ->IOCharBufferSource#

newBuffer ::Int ->Int ->BufferState ->IO (Buffer e)Source#

emptyBuffer ::RawBuffer e ->Int ->BufferState ->Buffer eSource#

Insertion/removal

bufferRemove ::Int ->Buffer e ->Buffer eSource#

bufferAdd ::Int ->Buffer e ->Buffer eSource#

slideContents ::BufferWord8 ->IO (BufferWord8)Source#

slides the contents of the buffer to the beginning

bufferAdjustL ::Int ->Buffer e ->Buffer eSource#

Inspecting

isEmptyBuffer ::Buffer e ->BoolSource#

isFullBuffer ::Buffer e ->BoolSource#

isFullCharBuffer ::Buffer e ->BoolSource#

isWriteBuffer ::Buffer e ->BoolSource#

bufferElems ::Buffer e ->IntSource#

bufferAvailable ::Buffer e ->IntSource#

summaryBuffer ::Buffer a ->StringSource#

Operating on the raw buffer as a Ptr

withBuffer ::Buffer e -> (Ptr e ->IO a) ->IO aSource#

withRawBuffer ::RawBuffer e -> (Ptr e ->IO a) ->IO aSource#

Assertions

checkBuffer ::Buffer a ->IO ()Source#

Raw buffers

typeRawBuffer e =ForeignPtr eSource#

readWord8Buf ::RawBufferWord8 ->Int ->IOWord8Source#

writeWord8Buf ::RawBufferWord8 ->Int ->Word8 ->IO ()Source#

typeRawCharBuffer =RawBufferCharBufElemSource#

peekCharBuf ::RawCharBuffer ->Int ->IOCharSource#

readCharBuf ::RawCharBuffer ->Int ->IO (Char,Int)Source#

writeCharBuf ::RawCharBuffer ->Int ->Char ->IOIntSource#

readCharBufPtr ::PtrCharBufElem ->Int ->IO (Char,Int)Source#

writeCharBufPtr ::PtrCharBufElem ->Int ->Char ->IOIntSource#

charSize ::IntSource#

Produced byHaddock version 2.20.0


[8]ページ先頭

©2009-2025 Movatter.jp