// Decompiled by Jad v1.5.7f. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) braces deadcode fieldsfirst 
// Source File Name:   CHAR.java
// Class Version:      45.3

package oracle.sql;

import java.io.*;
import java.math.BigDecimal;
import java.sql.*;
import oracle.jdbc.dbaccess.DBError;
import oracle.jdbc.util.RepConversion;

// Referenced classes of package oracle.sql:
//            Datum, CharacterSet

// flag ACC_SUPER is set
public class CHAR extends Datum
{
    // Constants:          256
    // Interfaces:         0
    // Fields:             4
    // Methods:            29
    // Class Attributes:   1


    public static final CharacterSet DEFAULT_CHARSET = CharacterSet.make(-1);
    private CharacterSet charSet;
    private int oracleId;
    private static byte empty[] = new byte[0];

    // Decompiling method: <init>  Signature: ()V
    // Max stack: 1, #locals: 1, #params: 1
    // Code length: 5 bytes, Code offset: 3105
    // Line Number Table found: 1 entries
    // Parameter  0 added: Name this Type Loracle/sql/CHAR; At 0 5 Range 0 4 Init 0 fixed
    // RetValue   1 added: Name <returnValue> Type V At 0 5 Range 0 4 Init 0 fixed
    protected CHAR()
    {
        super();
        return;
    }

    // Decompiling method: <init>  Signature: (Ljava/lang/Object;Loracle/sql/CharacterSet;)V
    // Max stack: 3, #locals: 3, #params: 3
    // Code length: 10 bytes, Code offset: 3148
    // Line Number Table found: 2 entries
    // Parameter  0 added: Name this Type Loracle/sql/CHAR; At 0 10 Range 0 9 Init 0 fixed
    // Parameter  1 added: Name obj Type Ljava/lang/Object; At 0 10 Range 0 9 Init 0
    // Parameter  2 added: Name characterset Type Loracle/sql/CharacterSet; At 0 10 Range 0 9 Init 0
    // RetValue   3 added: Name <returnValue> Type V At 0 10 Range 0 9 Init 0 fixed
    public CHAR(Object obj, CharacterSet characterset)
        throws SQLException
    {
        this(obj.toString(), characterset);
        return;
    }

    // Decompiling method: <init>  Signature: (Ljava/lang/String;Loracle/sql/CharacterSet;)V
    // Max stack: 3, #locals: 3, #params: 3
    // Code length: 23 bytes, Code offset: 3210
    // Line Number Table found: 5 entries
    // Parameter  0 added: Name this Type Loracle/sql/CHAR; At 0 23 Range 0 22 Init 0 fixed
    // Parameter  1 added: Name s Type Ljava/lang/String; At 0 23 Range 0 22 Init 0
    // Parameter  2 added: Name characterset Type Loracle/sql/CharacterSet; At 0 23 Range 0 22 Init 0
    // RetValue   3 added: Name <returnValue> Type V At 0 23 Range 0 22 Init 0 fixed
    public CHAR(String s, CharacterSet characterset)
        throws SQLException
    {
        super();
        if(characterset == null)
        {
            characterset = DEFAULT_CHARSET;
        }
        setValue(characterset.convert(s), characterset);
        return;
    }

    // Decompiling method: <init>  Signature: ([BIILoracle/sql/CharacterSet;)V
    // Max stack: 5, #locals: 6, #params: 5
    // Code length: 27 bytes, Code offset: 3297
    // Line Number Table found: 5 entries
    // Parameter  0 added: Name this Type Loracle/sql/CHAR; At 0 27 Range 0 26 Init 0 fixed
    // Parameter  1 added: Name abyte0 Type [B At 0 27 Range 0 26 Init 0
    // Parameter  2 added: Name i Type I At 0 27 Range 0 26 Init 0
    // Parameter  3 added: Name j Type I At 0 27 Range 0 26 Init 0
    // Parameter  4 added: Name characterset Type Loracle/sql/CharacterSet; At 0 27 Range 0 26 Init 0
    // RetValue   6 added: Name <returnValue> Type V At 0 27 Range 0 26 Init 0 fixed
    // LocalVar   5 added: Name abyte1 Type [B At 7 14 Range 7 20 Init 7
    public CHAR(byte abyte0[], int i, int j, CharacterSet characterset)
    {
        super();
        byte abyte1[] = new byte[j];
        System.arraycopy(abyte0, i, abyte1, 0, j);
        setValue(abyte1, characterset);
        return;
    }

    // Decompiling method: <init>  Signature: ([BLoracle/sql/CharacterSet;)V
    // Max stack: 3, #locals: 3, #params: 3
    // Code length: 11 bytes, Code offset: 3378
    // Line Number Table found: 3 entries
    // Parameter  0 added: Name this Type Loracle/sql/CHAR; At 0 11 Range 0 10 Init 0 fixed
    // Parameter  1 added: Name abyte0 Type [B At 0 11 Range 0 10 Init 0
    // Parameter  2 added: Name characterset Type Loracle/sql/CharacterSet; At 0 11 Range 0 10 Init 0
    // RetValue   3 added: Name <returnValue> Type V At 0 11 Range 0 10 Init 0 fixed
    public CHAR(byte abyte0[], CharacterSet characterset)
    {
        super();
        setValue(abyte0, characterset);
        return;
    }

    // Decompiling method: asciiStreamValue  Signature: ()Ljava/io/InputStream;
    // Max stack: 1, #locals: 1, #params: 1
    // Code length: 5 bytes, Code offset: 3435
    // Line Number Table found: 1 entries
    // Parameter  0 added: Name this Type Loracle/sql/CHAR; At 0 5 Range 0 4 Init 0 fixed
    // RetValue   1 added: Name <returnValue> Type Ljava/io/InputStream; At 0 5 Range 0 4 Init 0 fixed
    public InputStream asciiStreamValue()
        throws SQLException
    {
        return getStream();
    }

    // Decompiling method: bigDecimalValue  Signature: ()Ljava/math/BigDecimal;
    // Max stack: 3, #locals: 2, #params: 1
    // Code length: 27 bytes, Code offset: 3488
    // Exception table: 1 entries
    //           start  2 end 14 handler 17 type NumberFormatException
    // Line Number Table found: 7 entries
    // Parameter  0 added: Name this Type Loracle/sql/CHAR; At 0 27 Range 0 26 Init 0 fixed
    // RetValue   2 added: Name <returnValue> Type Ljava/math/BigDecimal; At 0 27 Range 0 26 Init 0 fixed
    // LocalVar   1 added: Name obj Type A At 1 25 Range 1 25 Init 1
    // LocalVar   1 chged: Name bigdecimal Oname obj Type Ljava/math/BigDecimal; At 13 13 Range 1 25 Init 1
    public BigDecimal bigDecimalValue()
        throws SQLException
    {
        BigDecimal bigdecimal = null;
        try
        {
            bigdecimal = new BigDecimal(stringValue());
        }
        catch(NumberFormatException _ex)
        {
            DBError.check_error(12, "bigDecimalValue");
        }
        return bigdecimal;
    }

    // Decompiling method: binaryStreamValue  Signature: ()Ljava/io/InputStream;
    // Max stack: 1, #locals: 1, #params: 1
    // Code length: 5 bytes, Code offset: 3595
    // Line Number Table found: 1 entries
    // Parameter  0 added: Name this Type Loracle/sql/CHAR; At 0 5 Range 0 4 Init 0 fixed
    // RetValue   1 added: Name <returnValue> Type Ljava/io/InputStream; At 0 5 Range 0 4 Init 0 fixed
    public InputStream binaryStreamValue()
        throws SQLException
    {
        return getStream();
    }

    // Decompiling method: booleanValue  Signature: ()Z
    // Max stack: 2, #locals: 2, #params: 1
    // Code length: 33 bytes, Code offset: 3648
    // Line Number Table found: 6 entries
    // Parameter  0 added: Name this Type Loracle/sql/CHAR; At 0 33 Range 0 32 Init 0 fixed
    // RetValue   2 added: Name <returnValue> Type Z At 0 33 Range 0 32 Init 0 fixed
    // LocalVar   1 added: Name s Type Ljava/lang/String; At 4 16 Range 4 19 Init 4
    public boolean booleanValue()
        throws SQLException
    {
        String s = stringValue();
        if(s == null)
        {
            return false;
        }
        return s.length() != 1 || s.charAt(0) != '0';
    }

    // Decompiling method: byteValue  Signature: ()B
    // Max stack: 4, #locals: 3, #params: 1
    // Code length: 30 bytes, Code offset: 3749
    // Line Number Table found: 4 entries
    // Parameter  0 added: Name this Type Loracle/sql/CHAR; At 0 30 Range 0 29 Init 0 fixed
    // RetValue   3 added: Name <returnValue> Type B At 0 30 Range 0 29 Init 0 fixed
    // LocalVar   1 added: Name l Type J At 4 23 Range 4 26 Init 4
    public byte byteValue()
        throws SQLException
    {
        long l = longValue();
        if(l > 127L || l < -128L)
        {
            DBError.throwSqlException(26);
        }
        return (byte)(int)l;
    }

    // Decompiling method: characterStreamValue  Signature: ()Ljava/io/Reader;
    // Max stack: 3, #locals: 1, #params: 1
    // Code length: 12 bytes, Code offset: 3839
    // Line Number Table found: 1 entries
    // Parameter  0 added: Name this Type Loracle/sql/CHAR; At 0 12 Range 0 11 Init 0 fixed
    // RetValue   1 added: Name <returnValue> Type Ljava/io/Reader; At 0 12 Range 0 11 Init 0 fixed
    public Reader characterStreamValue()
        throws SQLException
    {
        return new StringReader(getString());
    }

    // Decompiling method: dateValue  Signature: ()Ljava/sql/Date;
    // Max stack: 1, #locals: 1, #params: 1
    // Code length: 8 bytes, Code offset: 3899
    // Line Number Table found: 1 entries
    // Parameter  0 added: Name this Type Loracle/sql/CHAR; At 0 8 Range 0 7 Init 0 fixed
    // RetValue   1 added: Name <returnValue> Type Ljava/sql/Date; At 0 8 Range 0 7 Init 0 fixed
    public Date dateValue()
        throws SQLException
    {
        return Date.valueOf(stringValue());
    }

    // Decompiling method: doubleValue  Signature: ()D
    // Max stack: 2, #locals: 3, #params: 1
    // Code length: 24 bytes, Code offset: 3955
    // Exception table: 1 entries
    //           start  2 end 13 handler 16 type NumberFormatException
    // Line Number Table found: 7 entries
    // Parameter  0 added: Name this Type Loracle/sql/CHAR; At 0 24 Range 0 23 Init 0 fixed
    // RetValue   3 added: Name <returnValue> Type D At 0 24 Range 0 23 Init 0 fixed
    // LocalVar   1 added: Name d Type D At 1 22 Range 1 22 Init 1
    public double doubleValue()
        throws SQLException
    {
        double d = 0.0D;
        try
        {
            d = Double.valueOf(stringValue()).doubleValue();
        }
        catch(NumberFormatException _ex)
        {
            DBError.throwSqlException(59);
        }
        return d;
    }

    // Decompiling method: equals  Signature: (Ljava/lang/Object;)Z
    // Max stack: 2, #locals: 2, #params: 2
    // Code length: 38 bytes, Code offset: 4059
    // Line Number Table found: 3 entries
    // Parameter  0 added: Name this Type Loracle/sql/CHAR; At 0 38 Range 0 37 Init 0 fixed
    // Parameter  1 added: Name obj Type Ljava/lang/Object; At 0 38 Range 0 37 Init 0
    // RetValue   2 added: Name <returnValue> Type Z At 0 38 Range 0 37 Init 0 fixed
    public boolean equals(Object obj)
    {
        return (obj instanceof CHAR) && getCharacterSet().equals(((CHAR)obj).getCharacterSet()) && super.equals(obj);
    }

    // Decompiling method: floatValue  Signature: ()F
    // Max stack: 1, #locals: 2, #params: 1
    // Code length: 24 bytes, Code offset: 4143
    // Exception table: 1 entries
    //           start  2 end 13 handler 16 type NumberFormatException
    // Line Number Table found: 7 entries
    // Parameter  0 added: Name this Type Loracle/sql/CHAR; At 0 24 Range 0 23 Init 0 fixed
    // RetValue   2 added: Name <returnValue> Type F At 0 24 Range 0 23 Init 0 fixed
    // LocalVar   1 added: Name f Type F At 1 22 Range 1 22 Init 1
    public float floatValue()
        throws SQLException
    {
        float f = 0.0F;
        try
        {
            f = Float.valueOf(stringValue()).floatValue();
        }
        catch(NumberFormatException _ex)
        {
            DBError.throwSqlException(59);
        }
        return f;
    }

    // Decompiling method: getCharacterSet  Signature: ()Loracle/sql/CharacterSet;
    // Max stack: 2, #locals: 1, #params: 1
    // Code length: 35 bytes, Code offset: 4247
    // Line Number Table found: 5 entries
    // Parameter  0 added: Name this Type Loracle/sql/CHAR; At 0 35 Range 0 34 Init 0 fixed
    // RetValue   1 added: Name <returnValue> Type Loracle/sql/CharacterSet; At 0 35 Range 0 34 Init 0 fixed
    public CharacterSet getCharacterSet()
    {
        if(charSet == null)
        {
            if(oracleId == 0)
            {
                oracleId = -1;
            }
            charSet = CharacterSet.make(oracleId);
        }
        return charSet;
    }

    // Decompiling method: getString  Signature: ()Ljava/lang/String;
    // Max stack: 5, #locals: 1, #params: 1
    // Code length: 18 bytes, Code offset: 4336
    // Line Number Table found: 1 entries
    // Parameter  0 added: Name this Type Loracle/sql/CHAR; At 0 18 Range 0 17 Init 0 fixed
    // RetValue   1 added: Name <returnValue> Type Ljava/lang/String; At 0 18 Range 0 17 Init 0 fixed
    public String getString()
        throws SQLException
    {
        return getCharacterSet().toString(shareBytes(), 0, (int)getLength());
    }

    // Decompiling method: getStringWithReplacement  Signature: ()Ljava/lang/String;
    // Max stack: 4, #locals: 2, #params: 1
    // Code length: 17 bytes, Code offset: 4402
    // Line Number Table found: 2 entries
    // Parameter  0 added: Name this Type Loracle/sql/CHAR; At 0 17 Range 0 16 Init 0 fixed
    // RetValue   2 added: Name <returnValue> Type Ljava/lang/String; At 0 17 Range 0 16 Init 0 fixed
    // LocalVar   1 added: Name abyte0 Type [B At 4 8 Range 4 11 Init 4
    public String getStringWithReplacement()
    {
        byte abyte0[] = shareBytes();
        return getCharacterSet().toStringWithReplacement(abyte0, 0, abyte0.length);
    }

    // Decompiling method: intValue  Signature: ()I
    // Max stack: 4, #locals: 3, #params: 1
    // Code length: 29 bytes, Code offset: 4461
    // Line Number Table found: 4 entries
    // Parameter  0 added: Name this Type Loracle/sql/CHAR; At 0 29 Range 0 28 Init 0 fixed
    // RetValue   3 added: Name <returnValue> Type I At 0 29 Range 0 28 Init 0 fixed
    // LocalVar   1 added: Name l Type J At 4 23 Range 4 26 Init 4
    public int intValue()
        throws SQLException
    {
        long l = longValue();
        if(l > 0x07fffffffL || l < 0xffffffff80000000L)
        {
            DBError.throwSqlException(26);
        }
        return (int)l;
    }

    // Decompiling method: isConvertibleTo  Signature: (Ljava/lang/Class;)Z
    // Max stack: 2, #locals: 3, #params: 2
    // Code length: 81 bytes, Code offset: 4550
    // Line Number Table found: 11 entries
    // Parameter  0 added: Name this Type Loracle/sql/CHAR; At 0 81 Range 0 80 Init 0 fixed
    // Parameter  1 added: Name class1 Type Ljava/lang/Class; At 0 81 Range 0 80 Init 0
    // RetValue   3 added: Name <returnValue> Type Z At 0 81 Range 0 80 Init 0 fixed
    // LocalVar   2 added: Name s Type Ljava/lang/String; At 4 65 Range 4 68 Init 4
    public boolean isConvertibleTo(Class class1)
    {
        String s = class1.getName();
        return s.compareTo("java.lang.String") == 0 || s.compareTo("java.lang.Long") == 0 || s.compareTo("java.math.BigDecimal") == 0 || s.compareTo("java.io.InputStream") == 0 || s.compareTo("java.sql.Date") == 0 || s.compareTo("java.sql.Time") == 0 || s.compareTo("java.sql.Timestamp") == 0 || s.compareTo("java.io.Reader") == 0;
    }

    // Decompiling method: longValue  Signature: ()J
    // Max stack: 2, #locals: 3, #params: 1
    // Code length: 24 bytes, Code offset: 4709
    // Exception table: 1 entries
    //           start  2 end 13 handler 16 type NumberFormatException
    // Line Number Table found: 7 entries
    // Parameter  0 added: Name this Type Loracle/sql/CHAR; At 0 24 Range 0 23 Init 0 fixed
    // RetValue   3 added: Name <returnValue> Type J At 0 24 Range 0 23 Init 0 fixed
    // LocalVar   1 added: Name l Type J At 1 22 Range 1 22 Init 1
    public long longValue()
        throws SQLException
    {
        long l = 0L;
        try
        {
            l = Long.valueOf(stringValue()).longValue();
        }
        catch(NumberFormatException _ex)
        {
            DBError.throwSqlException(59);
        }
        return l;
    }

    // Decompiling method: makeJdbcArray  Signature: (I)Ljava/lang/Object;
    // Max stack: 1, #locals: 2, #params: 2
    // Code length: 5 bytes, Code offset: 4813
    // Line Number Table found: 1 entries
    // Parameter  0 added: Name this Type Loracle/sql/CHAR; At 0 5 Range 0 4 Init 0 fixed
    // Parameter  1 added: Name i Type I At 0 5 Range 0 4 Init 0
    // RetValue   2 added: Name <returnValue> Type Ljava/lang/Object; At 0 5 Range 0 4 Init 0 fixed
    public Object makeJdbcArray(int i)
    {
        return new String[i];
    }

    // Decompiling method: setValue  Signature: ([BLoracle/sql/CharacterSet;)V
    // Max stack: 2, #locals: 3, #params: 3
    // Code length: 42 bytes, Code offset: 4856
    // Line Number Table found: 4 entries
    // Parameter  0 added: Name this Type Loracle/sql/CHAR; At 0 42 Range 0 41 Init 0 fixed
    // Parameter  1 added: Name abyte0 Type [B At 0 42 Range 0 41 Init 0
    // Parameter  2 added: Name characterset Type Loracle/sql/CharacterSet; At 0 42 Range 0 41 Init 0
    // RetValue   3 added: Name <returnValue> Type V At 0 42 Range 0 41 Init 0 fixed
    void setValue(byte abyte0[], CharacterSet characterset)
    {
        charSet = characterset != null ? characterset : DEFAULT_CHARSET;
        oracleId = charSet.getOracleId();
        setShareBytes(abyte0 != null ? abyte0 : empty);
        return;
    }

    // Decompiling method: stringValue  Signature: ()Ljava/lang/String;
    // Max stack: 1, #locals: 1, #params: 1
    // Code length: 5 bytes, Code offset: 4948
    // Line Number Table found: 1 entries
    // Parameter  0 added: Name this Type Loracle/sql/CHAR; At 0 5 Range 0 4 Init 0 fixed
    // RetValue   1 added: Name <returnValue> Type Ljava/lang/String; At 0 5 Range 0 4 Init 0 fixed
    public String stringValue()
    {
        return toString();
    }

    // Decompiling method: timeValue  Signature: ()Ljava/sql/Time;
    // Max stack: 1, #locals: 1, #params: 1
    // Code length: 8 bytes, Code offset: 4991
    // Line Number Table found: 1 entries
    // Parameter  0 added: Name this Type Loracle/sql/CHAR; At 0 8 Range 0 7 Init 0 fixed
    // RetValue   1 added: Name <returnValue> Type Ljava/sql/Time; At 0 8 Range 0 7 Init 0 fixed
    public Time timeValue()
        throws SQLException
    {
        return Time.valueOf(stringValue());
    }

    // Decompiling method: timestampValue  Signature: ()Ljava/sql/Timestamp;
    // Max stack: 1, #locals: 1, #params: 1
    // Code length: 8 bytes, Code offset: 5047
    // Line Number Table found: 1 entries
    // Parameter  0 added: Name this Type Loracle/sql/CHAR; At 0 8 Range 0 7 Init 0 fixed
    // RetValue   1 added: Name <returnValue> Type Ljava/sql/Timestamp; At 0 8 Range 0 7 Init 0 fixed
    public Timestamp timestampValue()
        throws SQLException
    {
        return Timestamp.valueOf(stringValue());
    }

    // Decompiling method: toJdbc  Signature: ()Ljava/lang/Object;
    // Max stack: 1, #locals: 1, #params: 1
    // Code length: 5 bytes, Code offset: 5103
    // Line Number Table found: 1 entries
    // Parameter  0 added: Name this Type Loracle/sql/CHAR; At 0 5 Range 0 4 Init 0 fixed
    // RetValue   1 added: Name <returnValue> Type Ljava/lang/Object; At 0 5 Range 0 4 Init 0 fixed
    public Object toJdbc()
        throws SQLException
    {
        return stringValue();
    }

    // Decompiling method: toString  Signature: ()Ljava/lang/String;
    // Max stack: 3, #locals: 5, #params: 1
    // Code length: 88 bytes, Code offset: 5156
    // Exception table: 1 entries
    //           start  0 end 5 handler 8 type SQLException
    // Line Number Table found: 13 entries
    // Parameter  0 added: Name this Type Loracle/sql/CHAR; At 0 88 Range 0 87 Init 0 fixed
    // RetValue   5 added: Name <returnValue> Type Ljava/lang/String; At 0 88 Range 0 87 Init 0 fixed
    // LocalVar   1 added: Name s Type Ljava/lang/String; At 4 83 Range 4 86 Init 4
    // LocalVar   2 added: Name stringbuffer Type Ljava/lang/StringBuffer; At 16 66 Range 16 81 Init 16
    // LocalVar   3 added: Name abyte0 Type [B At 28 49 Range 28 76 Init 28
    // LocalVar   4 added: Name flag Type Z At 30 46 Range 30 75 Init 30
    // LocalVar   4 chged: Name i Oname flag Type I At 74 2 Range 30 75 Init 30
    public String toString()
    {
        String s;
        try
        {
            s = getString();
        }
        catch(SQLException _ex)
        {
            StringBuffer stringbuffer = new StringBuffer();
            stringbuffer.append("0x");
            byte abyte0[] = shareBytes();
            for(int i = 0; i < abyte0.length; i++)
            {
                stringbuffer.append((char)RepConversion.nibbleToHex((byte)(abyte0[i] >> 4 & 0xf)));
                stringbuffer.append((char)RepConversion.nibbleToHex((byte)(abyte0[i] & 0xf)));
            }

            s = stringbuffer.toString();
        }
        return s;
    }

    // Decompiling method: <clinit>  Signature: ()V
    // Max stack: 1, #locals: 0, #params: 0
    // Code length: 14 bytes, Code offset: 3045
    // Line Number Table found: 3 entries
    // RetValue   0 added: Name <returnValue> Type V At 0 14 Range 0 13 Init 0 fixed
    static 
    {
        /* DEFAULT_CHARSET = CharacterSet.make(-1); */
        /* empty = new byte[0]; */
    }
}
