Module Serialization

This module is undocumented. This is a list of its definitions.

ioSize :: IO a => a -> <Proc> Integer

The number of bytes that write produces for the given value.

ioSizeLength :: Integer -> Integer

The number of bytes that writeLength produces for the given length.

ioSizeString :: String -> Integer

The number of bytes that writeString produces for the given string.

read :: IO a => InputStream -> <Proc> a

Reads a value of the expected type from the stream.

readAllByteArray :: InputStream -> <Proc> Vector Byte

Reads all remaining bytes of the stream and closes it.

readAllString :: InputStream -> <Proc> String

Reads all remaining bytes of the stream as a UTF-8 string and closes it.

readBoolean :: InputStream -> <Proc> Boolean

Reads a boolean written by writeBoolean.

readByte :: InputStream -> <Proc> Byte

Reads a byte written by writeByte.

readByteArray :: IO a => Vector Byte -> a

Reads a value from the given byte array.

readCharacter :: InputStream -> <Proc> Character

Reads a character written by writeCharacter.

readDouble :: InputStream -> <Proc> Double

Reads a double written by writeDouble.

readDoubleArray :: InputStream -> <Proc> Vector Double

Reads a double array written by writeDoubleArray.

readFloat :: InputStream -> <Proc> Float

Reads a float written by writeFloat.

readInteger :: InputStream -> <Proc> Integer

Reads an integer written by writeInteger.

readLength :: InputStream -> <Proc> Integer

Reads a length written by writeLength.

readLong :: InputStream -> <Proc> Long

Reads a long written by writeLong.

readShort :: InputStream -> <Proc> Short

Reads a short written by writeShort.

readString :: InputStream -> <Proc> String

Reads a string written by writeString.

write :: IO a => OutputStream -> a -> <Proc> ()

Writes the given value to the stream.

writeBoolean :: OutputStream -> Boolean -> <Proc> ()

Writes a boolean as one byte.

writeByte :: OutputStream -> Byte -> <Proc> ()

Writes a byte.

writeByteArray :: IO a => a -> Vector Byte

Writes the given value into a new byte array.

writeCharacter :: OutputStream -> Character -> <Proc> ()

Writes a character as two bytes, most significant byte first.

writeDouble :: OutputStream -> Double -> <Proc> ()

Writes a double as eight bytes, most significant byte first.

writeDoubleArray :: OutputStream -> Vector Double -> <Proc> ()

Writes the length of the array followed by its elements.

writeFloat :: OutputStream -> Float -> <Proc> ()

Writes a float as four bytes, most significant byte first.

writeInteger :: OutputStream -> Integer -> <Proc> ()

Writes an integer as four bytes, most significant byte first.

writeLength :: OutputStream -> Integer -> <Proc> ()

Writes a non-negative length using a variable-length encoding that is compact for small values.

writeLong :: OutputStream -> Long -> <Proc> ()

Writes a long as eight bytes, most significant byte first.

writeShort :: OutputStream -> Short -> <Proc> ()

Writes a short as two bytes, most significant byte first.

writeString :: OutputStream -> String -> <Proc> ()

Writes the length of the UTF-8 encoding of the string followed by the encoded bytes.