protected CharArrayBase64Decoder _base64Decoder() { if (_base64Decoder == null) { _base64Decoder = new CharArrayBase64Decoder(); } return _base64Decoder; }
if (type == END_ELEMENT) { if (!dec.hasData()) { return -1; count = dec.decode(resultBuffer, offset, maxLength); } catch (IllegalArgumentException iae) { int left = dec.endOfContent(); if (left < 0) { // incomplete, error throw _constructTypeException("Incomplete base64 triplet at the end of decoded content", "");
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); } }
/** * Method that needs to be called to configure given base64 decoder * with textual contents collected by this buffer. * * @param dec Decoder that will need data * @param firstChunk Whether this is the first segment fed or not; * if it is, state needs to be fullt reset; if not, only partially. */ public void initBinaryChunks(Base64Variant v, CharArrayBase64Decoder dec, boolean firstChunk) { if (mInputStart < 0) { // non-shared dec.init(v, firstChunk, mCurrentSegment, 0, mCurrentSize, mSegments); } else { // shared dec.init(v, firstChunk, mInputBuffer, mInputStart, mInputLen, null); } }
public byte[] getElementAsBinary(Base64Variant v) throws XMLStreamException { // note: code here is similar to Base64DecoderBase.aggregateAll(), see comments there Stax2Util.ByteAggregator aggr = _base64Decoder().getByteAggregator(); byte[] buffer = aggr.startAggregation(); while (true) { int offset = 0; int len = buffer.length; do { int readCount = readElementAsBinary(buffer, offset, len, v); if (readCount < 1) { // all done! return aggr.aggregateAll(buffer, offset); } offset += readCount; len -= readCount; } while (len > 0); buffer = aggr.addFullBlock(buffer); } }
/** * Method that needs to be called to configure given base64 decoder * with textual contents collected by this buffer. * * @param dec Decoder that will need data * @param firstChunk Whether this is the first segment fed or not; * if it is, state needs to be fullt reset; if not, only partially. */ public void initBinaryChunks(Base64Variant v, CharArrayBase64Decoder dec, boolean firstChunk) { if (mInputStart < 0) { // non-shared dec.init(v, firstChunk, mCurrentSegment, 0, mCurrentSize, mSegments); } else { // shared dec.init(v, firstChunk, mInputBuffer, mInputStart, mInputLen, null); } }
public byte[] getElementAsBinary(Base64Variant v) throws XMLStreamException { // note: code here is similar to Base64DecoderBase.aggregateAll(), see comments there Stax2Util.ByteAggregator aggr = _base64Decoder().getByteAggregator(); byte[] buffer = aggr.startAggregation(); while (true) { int offset = 0; int len = buffer.length; do { int readCount = readElementAsBinary(buffer, offset, len, v); if (readCount < 1) { // all done! return aggr.aggregateAll(buffer, offset); } offset += readCount; len -= readCount; } while (len > 0); buffer = aggr.addFullBlock(buffer); } }
if (type == END_ELEMENT) { if (!dec.hasData()) { return -1; count = dec.decode(resultBuffer, offset, maxLength); } catch (IllegalArgumentException iae) { int left = dec.endOfContent(); if (left < 0) { // incomplete, error throw _constructTypeException("Incomplete base64 triplet at the end of decoded content", "");
public byte[] decodeBinaryValue(int index, Base64Variant v, CharArrayBase64Decoder dec, XmlScanner scanner) throws XMLStreamException { if (index < 0 || index >= _attrCount) { throw new IllegalArgumentException("Invalid index "+index+"; current element has only "+_attrCount+" attributes"); } int start, end; if (index == 0) { start = 0; end = _valueOffsets[0]; } else { start = _valueOffsets[index-1]; end = _valueOffsets[index]; } int len = end-start; dec.init(v, true, _valueBuffer, start, end, /* addl segments */ null); try { return dec.decodeCompletely(); } catch (IllegalArgumentException iae) { // Need to convert to a checked stream exception String lexical = new String(_valueBuffer, start, len); throw new TypedXMLStreamException(lexical, iae.getMessage(), scanner.getCurrentLocation(), iae); } }
protected CharArrayBase64Decoder _base64Decoder() { if (_base64Decoder == null) { _base64Decoder = new CharArrayBase64Decoder(); } return _base64Decoder; }
/** * Method that needs to be called to configure given base64 decoder * with textual contents collected by this buffer. * * @param dec Decoder that will need data * @param firstChunk Whether this is the first segment fed or not; * if it is, state needs to be fullt reset; if not, only partially. */ public void initBinaryChunks(Base64Variant v, CharArrayBase64Decoder dec, boolean firstChunk) { if (mInputStart < 0) { // non-shared dec.init(v, firstChunk, mCurrentSegment, 0, mCurrentSize, mSegments); } else { // shared dec.init(v, firstChunk, mInputBuffer, mInputStart, mInputLen, null); } }
@Override public byte[] getElementAsBinary(Base64Variant v) throws XMLStreamException { // note: code here is similar to Base64DecoderBase.aggregateAll(), see comments there Stax2Util.ByteAggregator aggr = _base64Decoder().getByteAggregator(); byte[] buffer = aggr.startAggregation(); while (true) { int offset = 0; int len = buffer.length; do { int readCount = readElementAsBinary(buffer, offset, len, v); if (readCount < 1) { // all done! return aggr.aggregateAll(buffer, offset); } offset += readCount; len -= readCount; } while (len > 0); buffer = aggr.addFullBlock(buffer); } }
if (type == END_ELEMENT) { if (!dec.hasData()) { return -1; count = dec.decode(resultBuffer, offset, maxLength); } catch (IllegalArgumentException iae) { int left = dec.endOfContent(); if (left < 0) { // incomplete, error throw _constructTypeException("Incomplete base64 triplet at the end of decoded content", "");
public byte[] decodeBinaryValue(int index, Base64Variant v, CharArrayBase64Decoder dec, XmlScanner scanner) throws XMLStreamException { if (index < 0 || index >= _attrCount) { throw new IllegalArgumentException("Invalid index "+index+"; current element has only "+_attrCount+" attributes"); } int start, end; if (index == 0) { start = 0; end = _valueOffsets[0]; } else { start = _valueOffsets[index-1]; end = _valueOffsets[index]; } int len = end-start; dec.init(v, true, _valueBuffer, start, end, /* addl segments */ null); try { return dec.decodeCompletely(); } catch (IllegalArgumentException iae) { // Need to convert to a checked stream exception String lexical = new String(_valueBuffer, start, len); throw new TypedXMLStreamException(lexical, iae.getMessage(), scanner.getCurrentLocation(), iae); } }
protected CharArrayBase64Decoder _base64Decoder() { if (_base64Decoder == null) { _base64Decoder = new CharArrayBase64Decoder(); } return _base64Decoder; }
/** * Method that needs to be called to configure given base64 decoder * with textual contents collected by this buffer. * * @param dec Decoder that will need data * @param firstChunk Whether this is the first segment fed or not; * if it is, state needs to be fullt reset; if not, only partially. */ public void initBinaryChunks(Base64Variant v, CharArrayBase64Decoder dec, boolean firstChunk) { if (mInputStart < 0) { // non-shared dec.init(v, firstChunk, mCurrentSegment, 0, mCurrentSize, mSegments); } else { // shared dec.init(v, firstChunk, mInputBuffer, mInputStart, mInputLen, null); } }
@Override public final byte[] getElementAsBinary(Base64Variant v) throws XMLStreamException { // note: code here is similar to Base64DecoderBase.aggregateAll(), see comments there Stax2Util.ByteAggregator aggr = _base64Decoder().getByteAggregator(); byte[] buffer = aggr.startAggregation(); while (true) { int offset = 0; int len = buffer.length; do { int readCount = readElementAsBinary(buffer, offset, len, v); if (readCount < 1) { // all done! return aggr.aggregateAll(buffer, offset); } offset += readCount; len -= readCount; } while (len > 0); buffer = aggr.addFullBlock(buffer); } }
if (type == END_ELEMENT) { if (!dec.hasData()) { return -1; count = dec.decode(resultBuffer, offset, maxLength); } catch (IllegalArgumentException iae) { int left = dec.endOfContent(); if (left < 0) { // incomplete, error throw _constructTypeException("Incomplete base64 triplet at the end of decoded content", "");
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); } }
protected CharArrayBase64Decoder _base64Decoder() { if (_base64Decoder == null) { _base64Decoder = new CharArrayBase64Decoder(); } return _base64Decoder; }