パッケージ org.postgresql.core
クラス Encoding
java.lang.Object
org.postgresql.core.Encoding
Representation of a particular character encoding.
-
コンストラクタの概要
コンストラクタ修飾子コンストラクタ説明protected
Use the charset passed as parameter and tests at creation time whether the specified encoding is compatible with ASCII numbers.protected
Subclasses may use this constructor if they know in advance of their ASCII number compatibility. -
メソッドの概要
修飾子とタイプメソッド説明static void
canonicalize
(String string) Indicates that string should be staged as a canonicalized value.decode
(byte[] encodedString) Decode an array of bytes into a string.decode
(byte[] encodedString, int offset, int length) Decode an array of bytes into a string.decodeCanonicalized
(byte[] encodedString) Decode an array of bytes possibly into a canonicalized string.decodeCanonicalized
(byte[] encodedString, int offset, int length) Decode an array of bytes possibly into a canonicalized string.decodeCanonicalizedIfPresent
(byte[] encodedString, int offset, int length) static Encoding
Get an Encoding using the default encoding for the JVM.byte @PolyNull []
Encode a string to an array of bytes.static Encoding
getDatabaseEncoding
(String databaseEncoding) Construct an Encoding for a given database encoding.Get a Reader that decodes the given InputStream using this encoding.Get a Writer that encodes to the given OutputStream using this encoding.static Encoding
getJVMEncoding
(String jvmEncoding) Construct an Encoding for a given JVM encoding.boolean
Returns true if this encoding has characters '-' and '0'..'9' in exactly same position as ascii.name()
Get the name of the (JVM) encoding used.toString()
-
コンストラクタの詳細
-
Encoding
Subclasses may use this constructor if they know in advance of their ASCII number compatibility.- パラメータ:
encoding
- charset to usefastASCIINumbers
- whether this encoding is compatible with ASCII numbers.
-
Encoding
Use the charset passed as parameter and tests at creation time whether the specified encoding is compatible with ASCII numbers.- パラメータ:
encoding
- charset to use
-
-
メソッドの詳細
-
hasAsciiNumbers
public boolean hasAsciiNumbers()Returns true if this encoding has characters '-' and '0'..'9' in exactly same position as ascii.- 戻り値:
- true if the bytes can be scanned directly for ascii numbers.
-
getJVMEncoding
Construct an Encoding for a given JVM encoding.- パラメータ:
jvmEncoding
- the name of the JVM encoding- 戻り値:
- an Encoding instance for the specified encoding, or an Encoding instance for the default JVM encoding if the specified encoding is unavailable.
-
getDatabaseEncoding
Construct an Encoding for a given database encoding.- パラメータ:
databaseEncoding
- the name of the database encoding- 戻り値:
- an Encoding instance for the specified encoding, or an Encoding instance for the default JVM encoding if the specified encoding is unavailable.
-
canonicalize
Indicates that string should be staged as a canonicalized value.This is intended for use with
String
constants.- パラメータ:
string
- The string to maintain canonicalized reference to. Must not benull
.- 関連項目:
-
name
Get the name of the (JVM) encoding used.- 戻り値:
- the JVM encoding name used by this instance.
-
encode
Encode a string to an array of bytes.- パラメータ:
s
- the string to encode- 戻り値:
- a bytearray containing the encoded string
- 例外:
IOException
- if something goes wrong
-
decodeCanonicalized
Decode an array of bytes possibly into a canonicalized string.Only ascii compatible encoding support canonicalization and only ascii
String
values are eligible to be canonicalized.- パラメータ:
encodedString
- a byte array containing the string to decodeoffset
- the offset inencodedString
of the first byte of the encoded representationlength
- the length, in bytes, of the encoded representation- 戻り値:
- the decoded string
- 例外:
IOException
- if something goes wrong
-
decodeCanonicalizedIfPresent
public String decodeCanonicalizedIfPresent(byte[] encodedString, int offset, int length) throws IOException - 例外:
IOException
-
decodeCanonicalized
Decode an array of bytes possibly into a canonicalized string.Only ascii compatible encoding support canonicalization and only ascii
String
values are eligible to be canonicalized.- パラメータ:
encodedString
- a byte array containing the string to decode- 戻り値:
- the decoded string
- 例外:
IOException
- if something goes wrong
-
decode
Decode an array of bytes into a string.- パラメータ:
encodedString
- a byte array containing the string to decodeoffset
- the offset inencodedString
of the first byte of the encoded representationlength
- the length, in bytes, of the encoded representation- 戻り値:
- the decoded string
- 例外:
IOException
- if something goes wrong
-
decode
Decode an array of bytes into a string.- パラメータ:
encodedString
- a byte array containing the string to decode- 戻り値:
- the decoded string
- 例外:
IOException
- if something goes wrong
-
getDecodingReader
Get a Reader that decodes the given InputStream using this encoding.- パラメータ:
in
- the underlying stream to decode from- 戻り値:
- a non-null Reader implementation.
- 例外:
IOException
- if something goes wrong
-
getEncodingWriter
Get a Writer that encodes to the given OutputStream using this encoding.- パラメータ:
out
- the underlying stream to encode to- 戻り値:
- a non-null Writer implementation.
- 例外:
IOException
- if something goes wrong
-
defaultEncoding
Get an Encoding using the default encoding for the JVM.- 戻り値:
- an Encoding instance
-
toString
-