Package oracle.sql

Class CharacterSetWithConverter


  • public abstract class CharacterSetWithConverter
    extends CharacterSet
    This is an abstract base class that all character sets that use CharacterConverter are based on.
    • Field Detail

      • ccFactory

        public static oracle.sql.converter.CharacterConverterFactory ccFactory
    • Method Detail

      • isLossyFrom

        public boolean isLossyFrom​(CharacterSet from)
        Description copied from class: CharacterSet
        A conversion looses information if the mapping is not invertible. (A mathematicial would say that the map of characters in from to this is not injective.)
        Specified by:
        isLossyFrom in class CharacterSet
        Parameters:
        from - a CharacterSet being tested for compatibility with this CharacterSet.
        Returns:
        true if characters in the from character set can be mapped uniquely to characters in oracleId representation.
      • isConvertibleFrom

        public boolean isConvertibleFrom​(CharacterSet source)
        Description copied from class: CharacterSet
        Are conversions supported.
        Specified by:
        isConvertibleFrom in class CharacterSet
        Parameters:
        source - a CharacterSet to inquire about
        Returns:
        true if conversion from source to oracleId is supported. If it isn't supported attempts to convert will always throw exceptions.
      • toStringWithReplacement

        public String toStringWithReplacement​(byte[] bytes,
                                              int offset,
                                              int count)
        Description copied from class: CharacterSet
        Convert bytes in oracleId representation to a String. If a character has no Unicode representation the effect is unspecified. The conversion might omit it, or replace it with a special character. The preferred result is replacement by a single character, but it is not guaranteed. If the conversion isn't supported at all, the result may be a fixed string.
        Specified by:
        toStringWithReplacement in class CharacterSet
        Parameters:
        bytes - a array containing characters represented in this character set.
        offset - the index of the first byte or the charcters
        count - the number of bytes to be converted.
        Returns:
        the String resulting from converting to UCS-2.
      • toString

        public String toString​(byte[] bytes,
                               int offset,
                               int count)
                        throws SQLException
        Description copied from class: CharacterSet
        Convert bytes in oracleId representation to a String. The difference between toStringInvertible and plain toString is that toStringInvertible will throw an exception when toString would make some replacement.
        Overrides:
        toString in class CharacterSet
        Parameters:
        bytes - a array containing characters represented in this character set.
        offset - the index of the first byte or the charcters
        count - the number of bytes to be converted.
        Returns:
        the String resulting from converting to UCS-2.
        Throws:
        SQLException - when conversion is not supported.
      • convert

        public byte[] convert​(String s)
                       throws SQLException
        Description copied from class: CharacterSet
        Convert a String to bytes in oracleId representation.
        Specified by:
        convert in class CharacterSet
        Returns:
        an array containing the sequence of bytes in oracleId representation that represent the sequence of Unicode characters in String.
        Throws:
        SQLException - when the oracleId does not support conversion from Unicode.
      • convertWithReplacement

        public byte[] convertWithReplacement​(String s)
        Description copied from class: CharacterSet
        Convert a String to bytes in oracleId representation. A String is always produced even when the conversion isn't supported or it contains characters that do not have a representation in oracleId. The usual conversion is to replace characters that don't have a representation with some fixed character, but that is not guranteed.
        Specified by:
        convertWithReplacement in class CharacterSet
        Returns:
        an array containing the sequence of bytes in oracleId representation that represent the sequence of Unicode characters in String.
      • convertWithReplacement

        public byte[] convertWithReplacement​(char[] chars,
                                             int charOffset,
                                             byte[] bytes,
                                             int byteOffset,
                                             int[] nchars)
        Description copied from class: CharacterSet
        Similar to convertWithReplacement(String s); Instead of a string, a char[] + offset with a length stored in nchars[0] will be converted.
        Overrides:
        convertWithReplacement in class CharacterSet
        Returns:
        an array containing the sequence of bytes in oracleId representation that represent the sequence of Unicode characters in the char[]. nchars[0] has the bytes length.
      • convert

        public byte[] convert​(CharacterSet from,
                              byte[] source,
                              int offset,
                              int count)
                       throws SQLException
        Description copied from class: CharacterSet
        Converts bytes in some representation to oracleId representation. Note that the input is not guaranteed to be different from the output. If a copy is always wanted then use convertUnshared.
        Specified by:
        convert in class CharacterSet
        Parameters:
        from - the character set of the input bytes
        source - an array of bytes containing the bytes to be converted
        offset - the index of the first byte to be converted
        count - the number of bytes to be converted
        Returns:
        a byte array in the Oracle character set
        Throws:
        SQLException - if the conversion is not supported