Copyright | (c) axionbuster 2025 |
---|---|
License | BSD-3-Clause |
Safe Haskell | None |
Language | GHC2021 |
M.NBT.Internal.JS
Description
Implements Java's Modified UTF-8 (CESU-8) encoding and decoding for string handling in NBT format.
See: https://docs.oracle.com/javase/8/docs/api/java/io/DataInput.html#modified-utf-8
Synopsis
- newtype JS = JS {}
- textascesu8 :: Text -> ByteString
- cesu8astext :: ByteString -> Maybe Text
- tocesu8 :: JS -> ByteString
- tocesu8p :: JS -> Builder
- fromcesu8 :: ByteString -> Maybe JS
- fromcesu8p :: forall (st :: ZeroBitType) r. Parser st r JS
Documentation
Java's CESU-8 encoding/decoding
this newtype is purely for modulation of encoding and decoding. it is not intended to be used directly in the public API
use textascesu8
and cesu8astext
to convert between Text
and ByteString
see:
Instances
NFData JS Source # | |||||
Defined in M.NBT.Internal.JS | |||||
Data JS Source # | |||||
Defined in M.NBT.Internal.JS Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> JS -> c JS # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c JS # dataTypeOf :: JS -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c JS) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JS) # gmapT :: (forall b. Data b => b -> b) -> JS -> JS # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> JS -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> JS -> r # gmapQ :: (forall d. Data d => d -> u) -> JS -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> JS -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> JS -> m JS # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> JS -> m JS # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> JS -> m JS # | |||||
IsString JS Source # | |||||
Defined in M.NBT.Internal.JS Methods fromString :: String -> JS # | |||||
Generic JS Source # | |||||
Defined in M.NBT.Internal.JS Associated Types
| |||||
Read JS Source # | |||||
Show JS Source # | |||||
Eq JS Source # | |||||
Ord JS Source # | |||||
Hashable JS Source # | |||||
Defined in M.NBT.Internal.JS | |||||
Pack JS Source # | |||||
Unpack JS Source # | |||||
Defined in M.NBT.Internal.JS | |||||
Lift JS Source # | |||||
type Rep JS Source # | |||||
Defined in M.NBT.Internal.JS |
textascesu8 :: Text -> ByteString Source #
encode Text
into CESU-8 ByteString
cesu8astext :: ByteString -> Maybe Text Source #
decode CESU-8 ByteString
into Text
tocesu8 :: JS -> ByteString Source #
encode text to CESU-8
fromcesu8p :: forall (st :: ZeroBitType) r. Parser st r JS Source #
decode CESU-8 encoded text (Parser
version)