Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- type FHandle = HandleOS Fd
- close ∷ FHandle → IO ()
- getSize ∷ FHandle → IO Word64
- open ∷ FilePath → OpenMode → IO Fd
- pread ∷ FHandle → Word64 → Word64 → IO ByteString
- preadBuf ∷ FHandle → Ptr Word8 → ByteCount → FileOffset → IO ByteCount
- pwriteBuf ∷ FHandle → Ptr Word8 → ByteCount → FileOffset → IO ByteCount
- read ∷ FHandle → Word64 → IO ByteString
- readBuf ∷ FHandle → Ptr Word8 → ByteCount → IO ByteCount
- seek ∷ FHandle → SeekMode → Int64 → IO ()
- truncate ∷ FHandle → Word64 → IO ()
- write ∷ FHandle → Ptr Word8 → Int64 → IO Word32
- writeBuf ∷ FHandle → Ptr Word8 → ByteCount → IO ByteCount
Documentation
getSize ∷ FHandle → IO Word64 Source #
File size of the given file pointer
NOTE: This is not thread safe (changes made to the file in other threads may affect this thread).
preadBuf ∷ FHandle → Ptr Word8 → ByteCount → FileOffset → IO ByteCount Source #
reads preadBuf
fh buf c offc
bytes into the buffer buf
from the file
handle fh
at the file offset off
. This does not move the position of the
file handle.
pwriteBuf ∷ FHandle → Ptr Word8 → ByteCount → FileOffset → IO ByteCount Source #
writes pwriteBuf
fh buf c offc
bytes from the data in the buffer
buf
to the file handle fh
at the file offset off
. This does not move
the position of the file handle.
read ∷ FHandle → Word64 → IO ByteString Source #
Reads a given number of bytes from the input FHandle
.
seek ∷ FHandle → SeekMode → Int64 → IO () Source #
Seek within the file.
The offset may be negative.
We don't return the new offset since the behaviour of lseek is rather odd (e.g., the file pointer may not actually be moved until a subsequent write)
truncate ∷ FHandle → Word64 → IO () Source #
Truncates the file managed by the input FHandle
to the input size.