パッケージ org.postgresql.core

クラス Encoding

java.lang.Object
org.postgresql.core.Encoding

public class Encoding extends Object
Representation of a particular character encoding.
  • コンストラクタの概要

    コンストラクタ
    修飾子
    コンストラクタ
    説明
    protected
    Encoding(Charset encoding)
    Use the charset passed as parameter and tests at creation time whether the specified encoding is compatible with ASCII numbers.
    protected
    Encoding(Charset encoding, boolean fastASCIINumbers)
    Subclasses may use this constructor if they know in advance of their ASCII number compatibility.
  • メソッドの概要

    修飾子とタイプ
    メソッド
    説明
    static void
    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(@PolyNull String s)
    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.
    Get the name of the (JVM) encoding used.
     

    クラスから継承されたメソッド java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • コンストラクタの詳細

    • Encoding

      protected Encoding(Charset encoding, boolean fastASCIINumbers)
      Subclasses may use this constructor if they know in advance of their ASCII number compatibility.
      パラメータ:
      encoding - charset to use
      fastASCIINumbers - whether this encoding is compatible with ASCII numbers.
    • Encoding

      protected Encoding(Charset 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

      public static Encoding getJVMEncoding(String jvmEncoding)
      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

      public static Encoding getDatabaseEncoding(String databaseEncoding)
      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

      public static void canonicalize(String string)
      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 be null.
      関連項目:
    • name

      public String name()
      Get the name of the (JVM) encoding used.
      戻り値:
      the JVM encoding name used by this instance.
    • encode

      public byte @PolyNull [] encode(@PolyNull String s) throws IOException
      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

      public String decodeCanonicalized(byte[] encodedString, int offset, int length) throws IOException
      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
      offset - the offset in encodedString of the first byte of the encoded representation
      length - 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

      public String decodeCanonicalized(byte[] encodedString) throws IOException
      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

      public String decode(byte[] encodedString, int offset, int length) throws IOException
      Decode an array of bytes into a string.
      パラメータ:
      encodedString - a byte array containing the string to decode
      offset - the offset in encodedString of the first byte of the encoded representation
      length - the length, in bytes, of the encoded representation
      戻り値:
      the decoded string
      例外:
      IOException - if something goes wrong
    • decode

      public String decode(byte[] encodedString) throws IOException
      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

      public Reader getDecodingReader(InputStream in) throws IOException
      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

      public Writer getEncodingWriter(OutputStream out) throws IOException
      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

      public static Encoding defaultEncoding()
      Get an Encoding using the default encoding for the JVM.
      戻り値:
      an Encoding instance
    • toString

      public String toString()
      オーバーライド:
      toString クラス内 Object