public class _codecs extends Object
codecs
class.Modifier and Type | Class and Description |
---|---|
static class |
_codecs.EncodingMap
Optimized charmap encoder mapping.
|
Constructor and Description |
---|
_codecs() |
Modifier and Type | Method and Description |
---|---|
static PyTuple |
ascii_decode(String str) |
static PyTuple |
ascii_decode(String str,
String errors) |
static PyTuple |
ascii_encode(String str) |
static PyTuple |
ascii_encode(String str,
String errors) |
static PyObject |
charmap_build(PyUnicode map) |
static PyTuple |
charmap_decode(String bytes)
Equivalent to
charmap_decode(bytes, errors, null) . |
static PyTuple |
charmap_decode(String bytes,
String errors)
Equivalent to
charmap_decode(bytes, errors, null) . |
static PyTuple |
charmap_decode(String bytes,
String errors,
PyObject mapping)
Decode a sequence of bytes into Unicode characters via a mapping supplied as a container to
be indexed by the byte values (as unsigned integers).
|
static PyTuple |
charmap_decode(String bytes,
String errors,
PyObject mapping,
boolean ignoreUnmapped)
Decode a sequence of bytes into Unicode characters via a mapping supplied as a container to
be indexed by the byte values (as unsigned integers).
|
static PyTuple |
charmap_encode(String str)
Equivalent to
charmap_encode(str, null, null) . |
static PyTuple |
charmap_encode(String str,
String errors)
Equivalent to
charmap_encode(str, errors, null) . |
static PyTuple |
charmap_encode(String str,
String errors,
PyObject mapping)
Encoder based on an optional character mapping.
|
static PyObject |
decode(PyString bytes)
Decode
bytes using the system default encoding (see
codecs.getDefaultEncoding() ). |
static PyObject |
decode(PyString bytes,
String encoding)
Decode
bytes using the codec registered for the encoding . |
static PyObject |
decode(PyString bytes,
String encoding,
String errors)
Decode
bytes using the codec registered for the encoding . |
static String |
encode_UTF16(String str,
String errors,
int byteorder) |
static PyString |
encode(PyUnicode unicode)
Encode
unicode using the system default encoding (see
codecs.getDefaultEncoding() ). |
static PyString |
encode(PyUnicode unicode,
String encoding)
Encode
unicode using the codec registered for the encoding . |
static PyString |
encode(PyUnicode unicode,
String encoding,
String errors)
Encode
unicode using the codec registered for the encoding . |
static PyTuple |
escape_decode(String str) |
static PyTuple |
escape_decode(String str,
String errors) |
static PyTuple |
escape_encode(String str) |
static PyTuple |
escape_encode(String str,
String errors) |
static PyTuple |
latin_1_decode(String str) |
static PyTuple |
latin_1_decode(String str,
String errors) |
static PyTuple |
latin_1_encode(String str) |
static PyTuple |
latin_1_encode(String str,
String errors) |
static PyObject |
lookup_error(String handlerName) |
static PyTuple |
lookup(String encoding) |
static PyTuple |
raw_unicode_escape_decode(String str) |
static PyTuple |
raw_unicode_escape_decode(String str,
String errors) |
static PyTuple |
raw_unicode_escape_encode(String str) |
static PyTuple |
raw_unicode_escape_encode(String str,
String errors) |
static void |
register_error(String name,
PyObject errorHandler) |
static void |
register(PyObject search_function) |
static PyObject |
translateCharmap(PyUnicode str,
String errors,
PyObject mapping) |
static PyTuple |
unicode_escape_decode(String str) |
static PyTuple |
unicode_escape_decode(String str,
String errors) |
static PyTuple |
unicode_escape_encode(String str) |
static PyTuple |
unicode_escape_encode(String str,
String errors) |
static PyTuple |
unicode_internal_decode(String bytes)
Deprecated.
|
static PyTuple |
unicode_internal_decode(String bytes,
String errors)
Deprecated.
|
static PyTuple |
unicode_internal_encode(String unicode)
Deprecated.
|
static PyTuple |
unicode_internal_encode(String unicode,
String errors)
Deprecated.
|
static PyTuple |
utf_16_be_decode(String str) |
static PyTuple |
utf_16_be_decode(String str,
String errors) |
static PyTuple |
utf_16_be_decode(String str,
String errors,
boolean final_) |
static PyTuple |
utf_16_be_encode(String str) |
static PyTuple |
utf_16_be_encode(String str,
String errors) |
static PyTuple |
utf_16_decode(String str) |
static PyTuple |
utf_16_decode(String str,
String errors) |
static PyTuple |
utf_16_decode(String str,
String errors,
boolean final_) |
static PyTuple |
utf_16_encode(String str) |
static PyTuple |
utf_16_encode(String str,
String errors) |
static PyTuple |
utf_16_encode(String str,
String errors,
int byteorder) |
static PyTuple |
utf_16_ex_decode(String str) |
static PyTuple |
utf_16_ex_decode(String str,
String errors) |
static PyTuple |
utf_16_ex_decode(String str,
String errors,
int byteorder) |
static PyTuple |
utf_16_ex_decode(String str,
String errors,
int byteorder,
boolean final_) |
static PyTuple |
utf_16_le_decode(String str) |
static PyTuple |
utf_16_le_decode(String str,
String errors) |
static PyTuple |
utf_16_le_decode(String str,
String errors,
boolean final_) |
static PyTuple |
utf_16_le_encode(String str) |
static PyTuple |
utf_16_le_encode(String str,
String errors) |
static PyTuple |
utf_32_be_decode(String bytes)
Decode a sequence of bytes representing the UTF-32 big-endian encoded form of a Unicode
string and return as a tuple the unicode text, and the amount of input consumed.
|
static PyTuple |
utf_32_be_decode(String bytes,
String errors)
Decode a sequence of bytes representing the UTF-32 big-endian encoded form of a Unicode
string and return as a tuple the unicode text, and the amount of input consumed.
|
static PyTuple |
utf_32_be_decode(String bytes,
String errors,
boolean isFinal)
Decode (perhaps partially) a sequence of bytes representing the UTF-32 big-endian encoded
form of a Unicode string and return as a tuple the unicode text, and the amount of input
consumed.
|
static PyTuple |
utf_32_be_encode(String unicode)
Encode a Unicode Java String as UTF-32 with big-endian byte order.
|
static PyTuple |
utf_32_be_encode(String unicode,
String errors)
Encode a Unicode Java String as UTF-32 with big-endian byte order.
|
static PyTuple |
utf_32_decode(String bytes)
Decode (perhaps partially) a sequence of bytes representing the UTF-32 encoded form of a
Unicode string and return as a tuple the unicode text, and the amount of input consumed.
|
static PyTuple |
utf_32_decode(String bytes,
String errors)
Decode a sequence of bytes representing the UTF-32 encoded form of a Unicode string and
return as a tuple the unicode text, and the amount of input consumed.
|
static PyTuple |
utf_32_decode(String bytes,
String errors,
boolean isFinal)
Decode (perhaps partially) a sequence of bytes representing the UTF-32 encoded form of a
Unicode string and return as a tuple the unicode text, and the amount of input consumed.
|
static PyTuple |
utf_32_encode(String unicode)
Encode a Unicode Java String as UTF-32 with byte order mark.
|
static PyTuple |
utf_32_encode(String unicode,
String errors)
Encode a Unicode Java String as UTF-32 with byte order mark.
|
static PyTuple |
utf_32_encode(String unicode,
String errors,
int byteorder)
Encode a Unicode Java String as UTF-32 in specified byte order with byte order mark.
|
static PyTuple |
utf_32_ex_decode(String bytes,
String errors,
int byteorder)
Decode a sequence of bytes representing the UTF-32 encoded form of a Unicode string and
return as a tuple the unicode text, the amount of input consumed, and the decoding
"endianness" used (in the Python -1, 0, +1 convention).
|
static PyTuple |
utf_32_ex_decode(String bytes,
String errors,
int byteorder,
boolean isFinal)
Decode (perhaps partially) a sequence of bytes representing the UTF-32 encoded form of a
Unicode string and return as a tuple the unicode text, the amount of input consumed, and the
decoding "endianness" used (in the Python -1, 0, +1 convention).
|
static PyTuple |
utf_32_le_decode(String bytes)
Decode a sequence of bytes representing the UTF-32 little-endian encoded form of a Unicode
string and return as a tuple the unicode text, and the amount of input consumed.
|
static PyTuple |
utf_32_le_decode(String bytes,
String errors)
Decode a sequence of bytes representing the UTF-32 little-endian encoded form of a Unicode
string and return as a tuple the unicode text, and the amount of input consumed.
|
static PyTuple |
utf_32_le_decode(String bytes,
String errors,
boolean isFinal)
Decode (perhaps partially) a sequence of bytes representing the UTF-32 little-endian encoded
form of a Unicode string and return as a tuple the unicode text, and the amount of input
consumed.
|
static PyTuple |
utf_32_le_encode(String unicode)
Encode a Unicode Java String as UTF-32 with little-endian byte order.
|
static PyTuple |
utf_32_le_encode(String unicode,
String errors)
Encode a Unicode Java String as UTF-32 with little-endian byte order.
|
static PyTuple |
utf_7_decode(String bytes) |
static PyTuple |
utf_7_decode(String bytes,
String errors) |
static PyTuple |
utf_7_decode(String bytes,
String errors,
boolean finalFlag) |
static PyTuple |
utf_7_encode(String str) |
static PyTuple |
utf_7_encode(String str,
String errors) |
static PyTuple |
utf_8_decode(String str) |
static PyTuple |
utf_8_decode(String str,
String errors) |
static PyTuple |
utf_8_decode(String str,
String errors,
boolean final_) |
static PyTuple |
utf_8_encode(String str) |
static PyTuple |
utf_8_encode(String str,
String errors) |
public static void register(PyObject search_function)
public static PyObject decode(PyString bytes)
bytes
using the system default encoding (see
codecs.getDefaultEncoding()
). Decoding errors raise a ValueError
.bytes
- to be decodedbytes
public static PyObject decode(PyString bytes, String encoding)
bytes
using the codec registered for the encoding
. The
encoding
defaults to the system default encoding (see
codecs.getDefaultEncoding()
). Decoding errors raise a ValueError
.bytes
- to be decodedencoding
- name of encoding (to look up in codec registry)bytes
public static PyObject decode(PyString bytes, String encoding, String errors)
bytes
using the codec registered for the encoding
. The
encoding
defaults to the system default encoding (see
codecs.getDefaultEncoding()
). The string errors
may name a different
error handling policy (built-in or registered with register_error(String, PyObject)
). The default error policy is 'strict' meaning that decoding errors raise a
ValueError
.bytes
- to be decodedencoding
- name of encoding (to look up in codec registry)errors
- error policy name (e.g. "ignore")bytes
public static PyString encode(PyUnicode unicode)
unicode
using the system default encoding (see
codecs.getDefaultEncoding()
). Encoding errors raise a ValueError
.unicode
- string to be encodedunicode
public static PyString encode(PyUnicode unicode, String encoding)
unicode
using the codec registered for the encoding
. The
encoding
defaults to the system default encoding (see
codecs.getDefaultEncoding()
). Encoding errors raise a ValueError
.unicode
- string to be encodedencoding
- name of encoding (to look up in codec registry)unicode
public static PyString encode(PyUnicode unicode, String encoding, String errors)
unicode
using the codec registered for the encoding
. The
encoding
defaults to the system default encoding (see
codecs.getDefaultEncoding()
). The string errors
may name a different
error handling policy (built-in or registered with register_error(String, PyObject)
). The default error policy is 'strict' meaning that encoding errors raise a
ValueError
.unicode
- string to be encodedencoding
- name of encoding (to look up in codec registry)errors
- error policy name (e.g. "ignore")unicode
public static PyTuple charmap_decode(String bytes)
charmap_decode(bytes, errors, null)
. This method is here so the
error and mapping arguments can be optional at the Python level.bytes
- sequence of bytes to decodepublic static PyTuple charmap_decode(String bytes, String errors)
charmap_decode(bytes, errors, null)
. This method is here so the
error argument can be optional at the Python level.bytes
- sequence of bytes to decodeerrors
- error policypublic static PyTuple charmap_decode(String bytes, String errors, PyObject mapping)
bytes
- sequence of bytes to decodeerrors
- error policymapping
- to convert bytes to characterspublic static PyTuple charmap_decode(String bytes, String errors, PyObject mapping, boolean ignoreUnmapped)
bytes
- sequence of bytes to decodeerrors
- error policymapping
- to convert bytes to charactersignoreUnmapped
- if true, pass unmapped byte values as character codes [0..256)public static PyObject translateCharmap(PyUnicode str, String errors, PyObject mapping)
public static PyTuple charmap_encode(String str)
charmap_encode(str, null, null)
. This method is here so the error
and mapping arguments can be optional at the Python level.str
- to be encodedpublic static PyTuple charmap_encode(String str, String errors)
charmap_encode(str, errors, null)
. This method is here so the
mapping can be optional at the Python level.str
- to be encodederrors
- error policy name (e.g. "ignore")public static PyTuple charmap_encode(String str, String errors, PyObject mapping)
EncodingMap
of 256 entries, or an arbitrary container indexable with integers
using __finditem__
and yielding byte strings. If the mapping is null, latin-1
(effectively a mapping of character code to the numerically-equal byte) is usedstr
- to be encodederrors
- error policy name (e.g. "ignore")mapping
- from character code to output byte (or string)public static PyTuple utf_16_ex_decode(String str, String errors, int byteorder, boolean final_)
public static PyTuple utf_32_encode(String unicode)
unicode
- to be encodedpublic static PyTuple utf_32_encode(String unicode, String errors)
unicode
- to be encodederrors
- error policy name or null meaning "strict"public static PyTuple utf_32_encode(String unicode, String errors, int byteorder)
unicode
- to be encodederrors
- error policy name or null meaning "strict"byteorder
- decoding "endianness" specified (in the Python -1, 0, +1 convention)public static PyTuple utf_32_le_encode(String unicode)
unicode
- to be encodedpublic static PyTuple utf_32_le_encode(String unicode, String errors)
unicode
- to be encodederrors
- error policy name or null meaning "strict"public static PyTuple utf_32_be_encode(String unicode)
unicode
- to be encodedpublic static PyTuple utf_32_be_encode(String unicode, String errors)
unicode
- to be encodederrors
- error policy name or null meaning "strict"public static PyTuple utf_32_decode(String bytes)
PyUnicode
). It is an error for the input bytes not to
form a whole number of valid UTF-32 codes.bytes
- to be decoded (Jython PyString
convention)public static PyTuple utf_32_decode(String bytes, String errors)
PyUnicode
). It is an error for the input bytes not to form a whole number of
valid UTF-32 codes.bytes
- to be decoded (Jython PyString
convention)errors
- error policy name (e.g. "ignore", "replace")public static PyTuple utf_32_decode(String bytes, String errors, boolean isFinal)
PyUnicode
).bytes
- to be decoded (Jython PyString
convention)errors
- error policy name (e.g. "ignore", "replace")isFinal
- if a "final" call, meaning the input must all be consumedpublic static PyTuple utf_32_le_decode(String bytes)
PyUnicode
). It is an error for the input bytes not to form a whole number of valid
UTF-32 codes.bytes
- to be decoded (Jython PyString
convention)public static PyTuple utf_32_le_decode(String bytes, String errors)
PyUnicode
). It is an error for the input bytes not to form a whole number of valid
UTF-32 codes.bytes
- to be decoded (Jython PyString
convention)errors
- error policy name (e.g. "ignore", "replace")public static PyTuple utf_32_le_decode(String bytes, String errors, boolean isFinal)
PyUnicode
).bytes
- to be decoded (Jython PyString
convention)errors
- error policy name (e.g. "ignore", "replace")isFinal
- if a "final" call, meaning the input must all be consumedpublic static PyTuple utf_32_be_decode(String bytes)
PyUnicode
). It is an error for the input bytes not to form a whole number of valid
UTF-32 codes.bytes
- to be decoded (Jython PyString
convention)public static PyTuple utf_32_be_decode(String bytes, String errors)
PyUnicode
). It is an error for the input bytes not to form a whole number of valid
UTF-32 codes.bytes
- to be decoded (Jython PyString
convention)errors
- error policy name (e.g. "ignore", "replace")public static PyTuple utf_32_be_decode(String bytes, String errors, boolean isFinal)
PyUnicode
).bytes
- to be decoded (Jython PyString
convention)errors
- error policy name (e.g. "ignore", "replace")isFinal
- if a "final" call, meaning the input must all be consumedpublic static PyTuple utf_32_ex_decode(String bytes, String errors, int byteorder)
utf_32.py
codec, but only until the byte order is known.) When
not defined by a BOM, processing assumes big-endian coding (Java platform default), but
returns "unspecified". (The utf_32.py
codec treats this as an error, once more
than 4 bytes have been processed.) (Java platform default). The unicode text is presented as
a Java String (the UTF-16 representation used by PyUnicode
).bytes
- to be decoded (Jython PyString
convention)errors
- error policy name (e.g. "ignore", "replace")byteorder
- decoding "endianness" specified (in the Python -1, 0, +1 convention)public static PyTuple utf_32_ex_decode(String bytes, String errors, int byteorder, boolean isFinal)
PyUnicode
).bytes
- to be decoded (Jython PyString
convention)errors
- error policy name (e.g. "ignore", "replace")byteorder
- decoding "endianness" specified (in the Python -1, 0, +1 convention)isFinal
- if a "final" call, meaning the input must all be consumedpublic static PyTuple raw_unicode_escape_encode(String str, String errors)
public static PyTuple raw_unicode_escape_decode(String str, String errors)
@Deprecated public static PyTuple unicode_internal_encode(String unicode)
@Deprecated public static PyTuple unicode_internal_encode(String unicode, String errors)
@Deprecated public static PyTuple unicode_internal_decode(String bytes)
@Deprecated public static PyTuple unicode_internal_decode(String bytes, String errors)