jni-0.7.0: Complete JNI raw bindings.
Safe HaskellNone
LanguageHaskell2010

Foreign.JNI.String

Description

JNI strings. Like C strings and unlike ByteString, these are null-terminated. Unlike C strings, each character is (multi-byte) encoded as UTF-8. Unlike UTF-8, embedded NULL characters are encoded as two bytes and the four-byte UTF-8 format for characters is not recognized. A custom encoding is used instead. See http://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/types.html#modified_utf_8_strings for more details.

NOTE: the current implementation does not support embedded NULL's and four-byte characters.

Synopsis

Documentation

data String Source #

Instances

Instances details
Eq String Source # 
Instance details

Defined in Foreign.JNI.String

Methods

(==) :: String -> String -> Bool #

(/=) :: String -> String -> Bool #

Ord String Source # 
Instance details

Defined in Foreign.JNI.String

Show String Source # 
Instance details

Defined in Foreign.JNI.String

IsString String Source # 
Instance details

Defined in Foreign.JNI.String

Methods

fromString :: String0 -> String #

fromByteString :: ByteString -> String Source #

O(1) if the input is null-terminated. Otherwise the input is copied into a null-terminated buffer first.

unsafeFromByteString :: ByteString -> String Source #

Same as fromByteString, but doesn't check whether the input is null-terminated or not.

withString :: String -> (CString -> IO a) -> IO a Source #