public final int readElementAsBinary(byte[] resultBuffer, int offset, int maxLength) throws XMLStreamException { return readElementAsBinary(resultBuffer, offset, maxLength, Base64Variants.getDefaultVariant()); }
protected TypedXMLStreamException _constructTypeException(String msg, String lexicalValue) { return new TypedXMLStreamException(lexicalValue, msg, getStartLocation()); }
/** * Method called to handle value that has empty String * as representation. This will usually either lead to an * exception, or parsing to the default value for the * type in question (null for nullable types and so on). */ private void _handleEmptyValue(TypedValueDecoder dec) throws XMLStreamException { try { // default action is to throw an exception dec.handleEmptyValue(); } catch (IllegalArgumentException iae) { throw _constructTypeException(iae, ""); } }
if (tad.decodeValue(buf, start, tokenEnd)) { if (!checkExpand(tad)) { break; throw new TypedXMLStreamException(lexical, iae.getMessage(), loc, iae);
tvd.handleEmptyValue(); return; tvd.decode(buf, start, end+1);
if (!dec.hasRoom()) { break;
} else { try { tvd.decode(tstr); } catch (IllegalArgumentException iae) { throw _constructTypeException(iae, str);
protected Base64Encoder(Base64Variant v, byte[] values, int from, int end) { _variant = v; _input = values; _inputPtr = from; _inputEnd = end; _chunksBeforeLf = _variant.getMaxLineLength() >> 2; }
public byte[] getAttributeAsBinary(int index) throws XMLStreamException { return getAttributeAsBinary(index, Base64Variants.getDefaultVariant()); }
if (tad.decodeValue(buf, start, tokenEnd)) { break; throw new TypedXMLStreamException(lexical, iae.getMessage(), loc, iae); } finally { mInputStart = ptr;
tvd.handleEmptyValue(); return; tvd.decode(buf, start, end+1);
/** * Method called to wrap or convert given conversion-fail exception * into a full {@link TypedXMLStreamException}, * * @param iae Problem as reported by converter * @param lexicalValue Lexical value (element content, attribute value) * that could not be converted succesfully. */ protected TypedXMLStreamException _constructTypeException(IllegalArgumentException iae, String lexicalValue) { return new TypedXMLStreamException(lexicalValue, iae.getMessage(), getStartLocation(), iae); } }
public final byte[] getElementAsBinary() throws XMLStreamException { return getElementAsBinary(Base64Variants.getDefaultVariant()); }
public final byte[] decodeBinary(int index, Base64Variant v, CharArrayBase64Decoder dec, InputProblemReporter rep) throws XMLStreamException { if (index < 0 || index >= mAttrCount) { throwIndex(index); } /* No point in trying to use String representation, even if one * available, faster to process from char[] */ Attribute attr = mAttributes[index]; char[] cbuf = mValueBuilder.getCharBuffer(); int start = attr.mValueStartOffset; int end = getValueStartOffset(index+1); int len = end-start; dec.init(v, true, cbuf, start, len, null); try { return dec.decodeCompletely(); } catch (IllegalArgumentException iae) { // Need to convert to a checked stream exception String lexical = new String(cbuf, start, len); throw new TypedXMLStreamException(lexical, iae.getMessage(), rep.getLocation(), iae); } }
public void writeBinary(byte[] value, int from, int length) throws XMLStreamException { Base64Variant v = Base64Variants.getDefaultVariant(); writeTypedElement(valueEncoderFactory().getEncoder(v, value, from, length)); }
protected TypedXMLStreamException _constructTypeException(String msg, String lexicalValue) { Location loc = getStartLocation(); if (loc == null) { return new TypedXMLStreamException(lexicalValue, msg); } return new TypedXMLStreamException(lexicalValue, msg, loc); } }
public void writeBinaryAttribute(String prefix, String nsURI, String localName, byte[] value) throws XMLStreamException { Base64Variant v = Base64Variants.getDefaultVariant(); writeTypedAttribute(prefix, nsURI, localName, valueEncoderFactory().getEncoder(v, value, 0, value.length)); }
@Override public final int readElementAsBinary(byte[] resultBuffer, int offset, int maxLength) throws XMLStreamException { return readElementAsBinary(resultBuffer, offset, maxLength, Base64Variants.getDefaultVariant()); }
@Override public final byte[] getAttributeAsBinary(int index) throws XMLStreamException { return getAttributeAsBinary(index, Base64Variants.getDefaultVariant()); }
public void writeBinary(byte[] value, int from, int length) throws XMLStreamException { writeBinary(Base64Variants.getDefaultVariant(), value, from, length); }