Examples of UTF8StringCharacterIterator


Examples of org.apache.vxquery.runtime.functions.strings.UTF8StringCharacterIterator

        writeByteValue(longp, dOut);
    }

    @Override
    public void convertString(UTF8StringPointable stringp, DataOutput dOut) throws SystemException, IOException {
        ICharacterIterator charIterator = new UTF8StringCharacterIterator(stringp);
        charIterator.reset();
        long value = 0;
        int c = 0;
        boolean negative = false;
        long limit = -Byte.MAX_VALUE;

        // Check the first character.
        c = charIterator.next();
        if (c == Character.valueOf('-') && negativeAllowed) {
            negative = true;
            c = charIterator.next();
            limit = Byte.MIN_VALUE;
        }

        // Read the numeric value.
        do {
            if (Character.isDigit(c)) {
                if (value < limit + Character.getNumericValue(c)) {
                    throw new SystemException(ErrorCode.FORG0001);
                }
                value = value * 10 - Character.getNumericValue(c);
            } else {
                throw new SystemException(ErrorCode.FORG0001);
            }
        } while ((c = charIterator.next()) != ICharacterIterator.EOS_CHAR);

        dOut.write(returnTag);
        dOut.write((byte) (negative ? value : -value));
    }
View Full Code Here

Examples of org.apache.vxquery.runtime.functions.strings.UTF8StringCharacterIterator

        dOut.writeLong(durationp.getDayTime());
    }

    @Override
    public void convertString(UTF8StringPointable stringp, DataOutput dOut) throws SystemException, IOException {
        ICharacterIterator charIterator = new UTF8StringCharacterIterator(stringp);
        charIterator.reset();
        boolean pastDecimal = false, timeSection = false;
        byte decimalPlace = 3;

        int value = 0;
        long day = 0, hour = 0, minute = 0, millisecond = 0;
        long negativeResult = 1;

        // First character
        int c = charIterator.next();
        if (c == Character.valueOf('-')) {
            negativeResult = -1;
            c = charIterator.next();
        }
        if (c != Character.valueOf('P')) {
            // Invalid duration format.
            throw new SystemException(ErrorCode.FORG0001);
        }

        while ((c = charIterator.next()) != ICharacterIterator.EOS_CHAR) {
            if (Character.isDigit(c)) {
                value = value * 10 + Character.getNumericValue(c);
                if (pastDecimal) {
                    --decimalPlace;
                }
View Full Code Here

Examples of org.apache.vxquery.runtime.functions.strings.UTF8StringCharacterIterator

        dOut.write(datep.getByteArray(), datep.getStartOffset(), datep.getLength());
    }

    @Override
    public void convertString(UTF8StringPointable stringp, DataOutput dOut) throws SystemException, IOException {
        ICharacterIterator charIterator = new UTF8StringCharacterIterator(stringp);
        charIterator.reset();
        int c;
        int index = 0;
        long[] date = new long[4];
        boolean positiveTimezone = false;
        boolean negativeYear = false;

        // Set defaults
        date[2] = DateTime.TIMEZONE_HOUR_NULL;
        date[3] = DateTime.TIMEZONE_MINUTE_NULL;

        while ((c = charIterator.next()) != ICharacterIterator.EOS_CHAR) {
            if (Character.isDigit(c)) {
                // Add the digit to the current numbered index.
                date[index] = date[index] * 10 + Character.getNumericValue(c);
            } else if (c == Character.valueOf('-') && index == 0 && date[index] == 0) {
                // If the first dash does not have a number in front, its a negative year.
View Full Code Here

Examples of org.apache.vxquery.runtime.functions.strings.UTF8StringCharacterIterator

        dOut.write(datep.getByteArray(), datep.getStartOffset(), datep.getLength());
    }

    @Override
    public void convertString(UTF8StringPointable stringp, DataOutput dOut) throws SystemException, IOException {
        ICharacterIterator charIterator = new UTF8StringCharacterIterator(stringp);
        charIterator.reset();
        int c;
        int index = 0;
        long[] date = new long[6];
        boolean positiveTimezone = false;

        // Set defaults
        date[4] = DateTime.TIMEZONE_HOUR_NULL;
        date[5] = DateTime.TIMEZONE_MINUTE_NULL;

        while ((c = charIterator.next()) != ICharacterIterator.EOS_CHAR) {
            if (Character.isDigit(c)) {
                // Add the digit to the current numbered index.
                date[index] = date[index] * 10 + Character.getNumericValue(c);
            } else if (c == Character.valueOf('-') || c == Character.valueOf(':')) {
                // The basic case for going to the next number in the series.
View Full Code Here

Examples of org.apache.vxquery.runtime.functions.strings.UTF8StringCharacterIterator

        dOut.write(binaryp.getByteArray(), binaryp.getStartOffset(), binaryp.getLength());
    }

    @Override
    public void convertString(UTF8StringPointable stringp, DataOutput dOut) throws SystemException, IOException {
        ICharacterIterator charIterator = new UTF8StringCharacterIterator(stringp);
        charIterator.reset();
        abvsInner.reset();
        int c1 = 0, c2 = 0, length = 0;
        while ((c1 = charIterator.next()) != ICharacterIterator.EOS_CHAR) {
            c2 = charIterator.next();
            if (c2 == ICharacterIterator.EOS_CHAR) {
                // Odd number of characters.
                throw new SystemException(ErrorCode.FORG0001);
            }
            if (Character.digit(c1, 16) < 0 || Character.digit(c1, 16) > 15 || Character.digit(c2, 16) < 0
View Full Code Here

Examples of org.apache.vxquery.runtime.functions.strings.UTF8StringCharacterIterator

        dOut.write(durationp.getByteArray(), durationp.getStartOffset(), durationp.getLength());
    }

    @Override
    public void convertString(UTF8StringPointable stringp, DataOutput dOut) throws SystemException, IOException {
        ICharacterIterator charIterator = new UTF8StringCharacterIterator(stringp);
        charIterator.reset();
        boolean pastDecimal = false, timeSection = false;
        byte decimalPlace = 3;

        int value = 0;
        long year = 0, month = 0, day = 0, hour = 0, minute = 0, millisecond = 0;
        long negativeResult = 1;

        // First character
        int c = charIterator.next();
        if (c == Character.valueOf('-')) {
            negativeResult = -1;
            c = charIterator.next();
        }
        if (c != Character.valueOf('P')) {
            // Invalid duration format.
            throw new SystemException(ErrorCode.FORG0001);
        }

        while ((c = charIterator.next()) != ICharacterIterator.EOS_CHAR) {
            if (Character.isDigit(c)) {
                value = value * 10 + Character.getNumericValue(c);
                if (pastDecimal) {
                    --decimalPlace;
                }
View Full Code Here

Examples of org.apache.vxquery.runtime.functions.strings.UTF8StringCharacterIterator

        dOut.write(datep.getByteArray(), datep.getStartOffset(), datep.getLength());
    }

    @Override
    public void convertString(UTF8StringPointable stringp, DataOutput dOut) throws SystemException, IOException {
        ICharacterIterator charIterator = new UTF8StringCharacterIterator(stringp);
        charIterator.reset();
        int c;
        int index = 0;
        long[] date = new long[6];
        boolean positiveTimezone = false;

        // Set defaults
        date[4] = DateTime.TIMEZONE_HOUR_NULL;
        date[5] = DateTime.TIMEZONE_MINUTE_NULL;

        while ((c = charIterator.next()) != ICharacterIterator.EOS_CHAR) {
            if (Character.isDigit(c)) {
                // Add the digit to the current numbered index.
                date[index] = date[index] * 10 + Character.getNumericValue(c);
            } else if (c == Character.valueOf('-') || c == Character.valueOf(':')) {
                // The basic case for going to the next number in the series.
View Full Code Here

Examples of org.apache.vxquery.runtime.functions.strings.UTF8StringCharacterIterator

    }

    @Override
    public void convertString(UTF8StringPointable stringp, DataOutput dOut) throws SystemException, IOException {
        abvsInner.reset();
        ICharacterIterator charIterator = new UTF8StringCharacterIterator(stringp);
        charIterator.reset();
        int c = 0;
        int prefixLength = 0;
        while ((c = charIterator.next()) != ICharacterIterator.EOS_CHAR) {
            if (c == Character.valueOf(':')) {
                prefixLength = abvsInner.getLength();
            } else {
                FunctionHelper.writeChar((char) c, dOutInner);
            }
View Full Code Here

Examples of org.apache.vxquery.runtime.functions.strings.UTF8StringCharacterIterator

        dOut.write(datetimep.getByteArray(), datetimep.getStartOffset(), datetimep.getLength());
    }

    @Override
    public void convertString(UTF8StringPointable stringp, DataOutput dOut) throws SystemException, IOException {
        ICharacterIterator charIterator = new UTF8StringCharacterIterator(stringp);
        charIterator.reset();
        int c;
        int index = 0;
        long[] date = new long[8];
        boolean positiveTimezone = false;
        boolean pastDecimal = false;
        boolean negativeYear = false;
        byte decimalPlace = 3;

        // Set defaults
        date[6] = DateTime.TIMEZONE_HOUR_NULL;
        date[7] = DateTime.TIMEZONE_MINUTE_NULL;

        while ((c = charIterator.next()) != ICharacterIterator.EOS_CHAR) {
            if (Character.isDigit(c)) {
                // Add the digit to the current numbered index.
                date[index] = date[index] * 10 + Character.getNumericValue(c);
                if (pastDecimal) {
                    --decimalPlace;
View Full Code Here

Examples of org.apache.vxquery.runtime.functions.strings.UTF8StringCharacterIterator

        dOut.write((byte) datetimep.getTimezoneMinute());
    }

    @Override
    public void convertString(UTF8StringPointable stringp, DataOutput dOut) throws SystemException, IOException {
        ICharacterIterator charIterator = new UTF8StringCharacterIterator(stringp);
        charIterator.reset();
        int c;
        int index = 0;
        long[] date = new long[5];
        boolean positiveTimezone = false;
        boolean negativeYear = false;

        // Set defaults
        date[3] = DateTime.TIMEZONE_HOUR_NULL;
        date[4] = DateTime.TIMEZONE_MINUTE_NULL;

        while ((c = charIterator.next()) != ICharacterIterator.EOS_CHAR) {
            if (Character.isDigit(c)) {
                // Add the digit to the current numbered index.
                date[index] = date[index] * 10 + Character.getNumericValue(c);
            } else if (c == Character.valueOf('-') && index == 0 && date[index] == 0) {
                // If the first dash does not have a number in front, its a negative year.
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.