Copyright | (c) The University of Glasgow 1994-2001 |
---|---|
License | see libraries/base/LICENSE |
Maintainer | libraries@haskell.org |
Stability | internal |
Portability | non-portable |
Safe Haskell | Trustworthy |
Language | Haskell2010 |
This module defines the basic operations on I/O "handles". All of the operations defined here are independent of the underlying device.
Synopsis
- withHandle :: String -> Handle -> (Handle__ -> IO (Handle__, a)) -> IO a
- withHandle' :: String -> Handle -> MVar Handle__ -> (Handle__ -> IO (Handle__, a)) -> IO a
- withHandle_ :: String -> Handle -> (Handle__ -> IO a) -> IO a
- withHandle__' :: String -> Handle -> MVar Handle__ -> (Handle__ -> IO Handle__) -> IO ()
- withHandle_' :: String -> Handle -> MVar Handle__ -> (Handle__ -> IO a) -> IO a
- withAllHandles__ :: String -> Handle -> (Handle__ -> IO Handle__) -> IO ()
- wantWritableHandle :: String -> Handle -> (Handle__ -> IO a) -> IO a
- wantReadableHandle :: String -> Handle -> (Handle__ -> IO (Handle__, a)) -> IO a
- wantReadableHandle_ :: String -> Handle -> (Handle__ -> IO a) -> IO a
- wantSeekableHandle :: String -> Handle -> (Handle__ -> IO a) -> IO a
- mkHandle :: (RawIO dev, IODevice dev, BufferedIO dev, Typeable dev) => dev -> FilePath -> HandleType -> Bool -> Maybe TextEncoding -> NewlineMode -> Maybe HandleFinalizer -> Maybe (MVar Handle__) -> IO Handle
- mkFileHandle :: (RawIO dev, IODevice dev, BufferedIO dev, Typeable dev) => dev -> FilePath -> IOMode -> Maybe TextEncoding -> NewlineMode -> IO Handle
- mkDuplexHandle :: (RawIO dev, IODevice dev, BufferedIO dev, Typeable dev) => dev -> FilePath -> Maybe TextEncoding -> NewlineMode -> IO Handle
- openTextEncoding :: Maybe TextEncoding -> HandleType -> (forall es ds. Maybe (TextEncoder es) -> Maybe (TextDecoder ds) -> IO a) -> IO a
- closeTextCodecs :: Handle__ -> IO ()
- initBufferState :: HandleType -> BufferState
- dEFAULT_CHAR_BUFFER_SIZE :: Int
- flushBuffer :: Handle__ -> IO ()
- flushWriteBuffer :: Handle__ -> IO ()
- flushCharReadBuffer :: Handle__ -> IO ()
- flushCharBuffer :: Handle__ -> IO ()
- flushByteReadBuffer :: Handle__ -> IO ()
- flushByteWriteBuffer :: Handle__ -> IO ()
- readTextDevice :: Handle__ -> CharBuffer -> IO CharBuffer
- writeCharBuffer :: Handle__ -> CharBuffer -> IO ()
- readTextDeviceNonBlocking :: Handle__ -> CharBuffer -> IO CharBuffer
- decodeByteBuf :: Handle__ -> CharBuffer -> IO CharBuffer
- augmentIOError :: IOException -> String -> Handle -> IOException
- ioe_closedHandle :: IO a
- ioe_semiclosedHandle :: IO a
- ioe_EOF :: IO a
- ioe_notReadable :: IO a
- ioe_notWritable :: IO a
- ioe_finalizedHandle :: FilePath -> Handle__
- ioe_bufsiz :: Int -> IO a
- hClose_help :: Handle__ -> IO (Handle__, Maybe SomeException)
- hLookAhead_ :: Handle__ -> IO Char
- type HandleFinalizer = FilePath -> MVar Handle__ -> IO ()
- handleFinalizer :: FilePath -> MVar Handle__ -> IO ()
- debugIO :: String -> IO ()
- traceIO :: String -> IO ()
Documentation
mkHandle :: (RawIO dev, IODevice dev, BufferedIO dev, Typeable dev) => dev -> FilePath -> HandleType -> Bool -> Maybe TextEncoding -> NewlineMode -> Maybe HandleFinalizer -> Maybe (MVar Handle__) -> IO Handle Source #
:: (RawIO dev, IODevice dev, BufferedIO dev, Typeable dev) | |
=> dev | the underlying IO device, which must support
|
-> FilePath | a string describing the |
-> IOMode | |
-> Maybe TextEncoding | |
-> NewlineMode | |
-> IO Handle |
makes a new Handle
mkDuplexHandle :: (RawIO dev, IODevice dev, BufferedIO dev, Typeable dev) => dev -> FilePath -> Maybe TextEncoding -> NewlineMode -> IO Handle Source #
like mkFileHandle
, except that a Handle
is created with two
independent buffers, one for reading and one for writing. Used for
full-duplex streams, such as network sockets.
openTextEncoding :: Maybe TextEncoding -> HandleType -> (forall es ds. Maybe (TextEncoder es) -> Maybe (TextDecoder ds) -> IO a) -> IO a Source #
closeTextCodecs :: Handle__ -> IO () Source #
flushBuffer :: Handle__ -> IO () Source #
syncs the file with the buffer, including moving the file pointer backwards in the case of a read buffer. This can fail on a non-seekable read Handle.
flushWriteBuffer :: Handle__ -> IO () Source #
flushCharReadBuffer :: Handle__ -> IO () Source #
flushCharBuffer :: Handle__ -> IO () Source #
flushes the Char buffer only. Works on all Handles.
flushByteReadBuffer :: Handle__ -> IO () Source #
flushByteWriteBuffer :: Handle__ -> IO () Source #
readTextDevice :: Handle__ -> CharBuffer -> IO CharBuffer Source #
writeCharBuffer :: Handle__ -> CharBuffer -> IO () Source #
decodeByteBuf :: Handle__ -> CharBuffer -> IO CharBuffer Source #
augmentIOError :: IOException -> String -> Handle -> IOException Source #
ioe_closedHandle :: IO a Source #
ioe_semiclosedHandle :: IO a Source #
ioe_notReadable :: IO a Source #
ioe_notWritable :: IO a Source #
ioe_bufsiz :: Int -> IO a Source #
hClose_help :: Handle__ -> IO (Handle__, Maybe SomeException) Source #