com.sun.xml.internal.bind.DatatypeConverterImpl Java Examples

The following examples show how to use com.sun.xml.internal.bind.DatatypeConverterImpl. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UTF8XmlOutput.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Writes the given byte[] as base64 encoded binary to the output.
 *
 * <p>
 * Being defined on this class allows this method to access the buffer directly,
 * which translates to a better performance.
 */
public void text(byte[] data, int dataLen) throws IOException {
    closeStartTag();

    int start = 0;

    while(dataLen>0) {
        // how many bytes (in data) can we write without overflowing the buffer?
        int batchSize = Math.min(((octetBuffer.length-octetBufferIndex)/4)*3,dataLen);

        // write the batch
        octetBufferIndex = DatatypeConverterImpl._printBase64Binary(data,start,batchSize,octetBuffer,octetBufferIndex);

        if(batchSize<dataLen)
            flushBuffer();

        start += batchSize;
        dataLen -= batchSize;

    }
}
 
Example #2
Source File: UTF8XmlOutput.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Writes the given byte[] as base64 encoded binary to the output.
 *
 * <p>
 * Being defined on this class allows this method to access the buffer directly,
 * which translates to a better performance.
 */
public void text(byte[] data, int dataLen) throws IOException {
    closeStartTag();

    int start = 0;

    while(dataLen>0) {
        // how many bytes (in data) can we write without overflowing the buffer?
        int batchSize = Math.min(((octetBuffer.length-octetBufferIndex)/4)*3,dataLen);

        // write the batch
        octetBufferIndex = DatatypeConverterImpl._printBase64Binary(data,start,batchSize,octetBuffer,octetBufferIndex);

        if(batchSize<dataLen)
            flushBuffer();

        start += batchSize;
        dataLen -= batchSize;

    }
}
 
Example #3
Source File: RuntimeBuiltinLeafInfoImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public String print(Date v) {
    XMLSerializer xs = XMLSerializer.getInstance();
    QName type = xs.getSchemaType();
    GregorianCalendar cal = new GregorianCalendar(0,0,0);
    cal.setTime(v);
    if ((type != null) && (WellKnownNamespace.XML_SCHEMA.equals(type.getNamespaceURI())) &&
            DATE.equals(type.getLocalPart())) {
        return DatatypeConverterImpl._printDate(cal);
    } else {
        return DatatypeConverterImpl._printDateTime(cal);
    }
}
 
Example #4
Source File: RuntimeBuiltinLeafInfoImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static byte[] decodeBase64(CharSequence text) {
    if (text instanceof Base64Data) {
        Base64Data base64Data = (Base64Data) text;
        return base64Data.getExact();
    } else {
        return DatatypeConverterImpl._parseBase64Binary(text.toString());
    }
}
 
Example #5
Source File: RuntimeBuiltinLeafInfoImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static byte[] decodeBase64(CharSequence text) {
    if (text instanceof Base64Data) {
        Base64Data base64Data = (Base64Data) text;
        return base64Data.getExact();
    } else {
        return DatatypeConverterImpl._parseBase64Binary(text.toString());
    }
}
 
Example #6
Source File: RuntimeBuiltinLeafInfoImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public String print(Date v) {
    XMLSerializer xs = XMLSerializer.getInstance();
    QName type = xs.getSchemaType();
    GregorianCalendar cal = new GregorianCalendar(0,0,0);
    cal.setTime(v);
    if ((type != null) && (WellKnownNamespace.XML_SCHEMA.equals(type.getNamespaceURI())) &&
            DATE.equals(type.getLocalPart())) {
        return DatatypeConverterImpl._printDate(cal);
    } else {
        return DatatypeConverterImpl._printDateTime(cal);
    }
}
 
Example #7
Source File: RuntimeBuiltinLeafInfoImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public String print(Date v) {
    XMLSerializer xs = XMLSerializer.getInstance();
    QName type = xs.getSchemaType();
    GregorianCalendar cal = new GregorianCalendar(0,0,0);
    cal.setTime(v);
    if ((type != null) && (WellKnownNamespace.XML_SCHEMA.equals(type.getNamespaceURI())) &&
            DATE.equals(type.getLocalPart())) {
        return DatatypeConverterImpl._printDate(cal);
    } else {
        return DatatypeConverterImpl._printDateTime(cal);
    }
}
 
Example #8
Source File: RuntimeBuiltinLeafInfoImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public XMLGregorianCalendar parse(CharSequence lexical) throws SAXException {
    try {
        return DatatypeConverterImpl.getDatatypeFactory()
                .newXMLGregorianCalendar(lexical.toString().trim()); // (.trim() - issue 396)
    } catch (Exception e) {
        UnmarshallingContext.getInstance().handleError(e);
        return null;
    }
}
 
Example #9
Source File: RuntimeBuiltinLeafInfoImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static byte[] decodeBase64(CharSequence text) {
    if (text instanceof Base64Data) {
        Base64Data base64Data = (Base64Data) text;
        return base64Data.getExact();
    } else {
        return DatatypeConverterImpl._parseBase64Binary(text.toString());
    }
}
 
Example #10
Source File: RuntimeBuiltinLeafInfoImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public Date parse(CharSequence text) {
    return DatatypeConverterImpl._parseDateTime(text.toString()).getTime();
}
 
Example #11
Source File: TransducedAccessor_field_Long.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public String print(Object o) {
    return DatatypeConverterImpl._printLong( ((Bean)o).f_long );
}
 
Example #12
Source File: TransducedAccessor_method_Byte.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public void parse(Object o, CharSequence lexical) {
    ((Bean)o).set_byte(DatatypeConverterImpl._parseByte(lexical));
}
 
Example #13
Source File: TransducedAccessor_method_Float.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public void parse(Object o, CharSequence lexical) {
    ((Bean)o).set_float(DatatypeConverterImpl._parseFloat(lexical));
}
 
Example #14
Source File: TransducedAccessor_field_Boolean.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public String print(Object o) {
    return DatatypeConverterImpl._printBoolean( ((Bean)o).f_boolean );
}
 
Example #15
Source File: RuntimeBuiltinLeafInfoImpl.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public Duration parse(CharSequence lexical) {
    TODO.checkSpec("JSR222 Issue #42");
    return DatatypeConverterImpl.getDatatypeFactory().newDuration(lexical.toString());
}
 
Example #16
Source File: RuntimeBuiltinLeafInfoImpl.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public String print(Byte v) {
    return DatatypeConverterImpl._printByte(v);
}
 
Example #17
Source File: TransducedAccessor_field_Short.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public String print(Object o) {
    return DatatypeConverterImpl._printShort( ((Bean)o).f_short );
}
 
Example #18
Source File: RuntimeBuiltinLeafInfoImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public Duration parse(CharSequence lexical) {
    TODO.checkSpec("JSR222 Issue #42");
    return DatatypeConverterImpl.getDatatypeFactory().newDuration(lexical.toString());
}
 
Example #19
Source File: TransducedAccessor_field_Boolean.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public String print(Object o) {
    return DatatypeConverterImpl._printBoolean( ((Bean)o).f_boolean );
}
 
Example #20
Source File: RuntimeBuiltinLeafInfoImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public String print(BigDecimal v) {
    return DatatypeConverterImpl._printDecimal(v);
}
 
Example #21
Source File: RuntimeBuiltinLeafInfoImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public Double parse(CharSequence text) {
    return DatatypeConverterImpl._parseDouble(text);
}
 
Example #22
Source File: TransducedAccessor_method_Float.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public void parse(Object o, CharSequence lexical) {
    ((Bean)o).set_float(DatatypeConverterImpl._parseFloat(lexical));
}
 
Example #23
Source File: TransducedAccessor_method_Double.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public void parse(Object o, CharSequence lexical) {
    ((Bean)o).set_double(DatatypeConverterImpl._parseDouble(lexical));
}
 
Example #24
Source File: TransducedAccessor_method_Boolean.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public String print(Object o) {
    return DatatypeConverterImpl._printBoolean( ((Bean)o).get_boolean() );
}
 
Example #25
Source File: RuntimeBuiltinLeafInfoImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public Date parse(CharSequence text) {
    return DatatypeConverterImpl._parseDateTime(text.toString()).getTime();
}
 
Example #26
Source File: TransducedAccessor_method_Long.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public String print(Object o) {
    return DatatypeConverterImpl._printLong( ((Bean)o).get_long() );
}
 
Example #27
Source File: TransducedAccessor_method_Byte.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public String print(Object o) {
    return DatatypeConverterImpl._printByte( ((Bean)o).get_byte() );
}
 
Example #28
Source File: TransducedAccessor_field_Boolean.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public void parse(Object o, CharSequence lexical) {
    Boolean b = DatatypeConverterImpl._parseBoolean(lexical);

    if(b != null)
        ((Bean)o).f_boolean=b;
}
 
Example #29
Source File: RuntimeBuiltinLeafInfoImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public Date parse(CharSequence text) {
    return DatatypeConverterImpl._parseDateTime(text.toString()).getTime();
}
 
Example #30
Source File: TransducedAccessor_method_Double.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public String print(Object o) {
    return DatatypeConverterImpl._printDouble( ((Bean)o).get_double() );
}