/** * @param parent * @param entityName Name of the entity expanded to create this input * source: null when source created for the (main level) external * DTD subset entity. * @param xmlVersion Optional xml version identifier of the main parsed * document. Currently only relevant for checking that XML 1.0 document * does not include XML 1.1 external parsed entities. * If unknown, no checks will be done. */ public static ReaderSource constructEntitySource (ReaderConfig cfg, WstxInputSource parent, String entityName, InputBootstrapper bs, String pubId, SystemId sysId, int xmlVersion, Reader r) { // true -> do close the underlying Reader at EOF ReaderSource rs = new ReaderSource (cfg, parent, entityName, pubId, sysId, r, true); if (bs != null) { rs.setInputOffsets(bs.getInputTotal(), bs.getInputRow(), -bs.getInputColumn()); } return rs; }
public void close() throws IOException { /* Buffer gets nullified by call to close() or closeCompletely(), * no need to call second time */ if (mBuffer != null) { // so that it's ok to call multiple times closeAndRecycle(mDoRealClose); } }
public int readInto(WstxInputData reader) throws IOException, XMLStreamException { // Need to flush out branched content? if (mBranchBuffer != null) { if (mInputLast > mBranchStartOffset) { appendBranched(mBranchStartOffset, mInputLast); } mBranchStartOffset = 0; } return super.readInto(reader); }
public boolean readMore(WstxInputData reader, int minAmount) throws IOException, XMLStreamException { // Existing data to output to branch? if (mBranchBuffer != null) { int ptr = reader.mInputPtr; int currAmount = mInputLast - ptr; if (currAmount > 0) { if (ptr > mBranchStartOffset) { appendBranched(mBranchStartOffset, ptr); } mBranchStartOffset = 0; } } return super.readMore(reader, minAmount); }
throw new WstxException("Reader (of type "+mReader.getClass().getName()+") returned 0 characters, even when asked to read up to "+mBuffer.length, getLocation());
public boolean readMore(WstxInputData reader, int minAmount) throws IOException { // Existing data to output to branch? if (mBranchBuffer != null) { int ptr = reader.mInputPtr; int currAmount = mInputLen - ptr; if (currAmount > 0) { if (ptr > mBranchStartOffset) { appendBranched(mBranchStartOffset, ptr); } mBranchStartOffset = 0; } } return super.readMore(reader, minAmount); }
if (actual < 1) { if (actual == 0) { // sanity check: throw new WstxException("Reader (of type "+mReader.getClass().getName()+") returned 0 characters, even when asked to read up to "+amount, getLocation());
/** * @param parent * @param entityName Name of the entity expanded to create this input * source: null when source created for the (main level) external * DTD subset entity. * @param xmlVersion Optional xml version identifier of the main parsed * document. Currently only relevant for checking that XML 1.0 document * does not include XML 1.1 external parsed entities. * If unknown, no checks will be done. */ public static ReaderSource constructEntitySource (ReaderConfig cfg, WstxInputSource parent, String entityName, InputBootstrapper bs, String pubId, SystemId sysId, int xmlVersion, Reader r) { // true -> do close the underlying Reader at EOF ReaderSource rs = new ReaderSource (cfg, parent, entityName, pubId, sysId, r, true); if (bs != null) { rs.setInputOffsets(bs.getInputTotal(), bs.getInputRow(), -bs.getInputColumn()); } return rs; }
public void closeCompletely() throws IOException { /* Only need to call if the Reader is not yet null... since * buffer may have been cleaned by a call to close() */ if (mReader != null) { // so that it's ok to call multiple times closeAndRecycle(true); } }
public int readInto(WstxInputData reader) throws IOException { // Need to flush out branched content? if (mBranchBuffer != null) { if (mInputLen > mBranchStartOffset) { appendBranched(mBranchStartOffset, mInputLen); } mBranchStartOffset = 0; } return super.readInto(reader); }
public boolean readMore(WstxInputData reader, int minAmount) throws IOException { // Existing data to output to branch? if (mBranchBuffer != null) { int ptr = reader.mInputPtr; int currAmount = mInputLen - ptr; if (currAmount > 0) { if (ptr > mBranchStartOffset) { appendBranched(mBranchStartOffset, ptr); } mBranchStartOffset = 0; } } return super.readMore(reader, minAmount); }
throw new WstxException("Reader (of type "+mReader.getClass().getName()+") returned 0 characters, even when asked to read up to "+mBuffer.length, getLocation());
/** * @param parent * @param entityName Name of the entity expanded to create this input * source: null when source created for the (main level) external * DTD subset entity. * @param xmlVersion Optional xml version identifier of the main parsed * document. Currently only relevant for checking that XML 1.0 document * does not include XML 1.1 external parsed entities. * If unknown, no checks will be done. */ public static ReaderSource constructEntitySource (ReaderConfig cfg, WstxInputSource parent, String entityName, InputBootstrapper bs, String pubId, SystemId sysId, int xmlVersion, Reader r) { // true -> do close the underlying Reader at EOF ReaderSource rs = new ReaderSource (cfg, parent, entityName, pubId, sysId, r, true); if (bs != null) { rs.setInputOffsets(bs.getInputTotal(), bs.getInputRow(), -bs.getInputColumn()); } return rs; }
@Override public void close() throws IOException { /* Buffer gets nullified by call to close() or closeCompletely(), * no need to call second time */ if (mBuffer != null) { // so that it's ok to call multiple times closeAndRecycle(mDoRealClose); } }
public int readInto(WstxInputData reader) throws IOException { // Need to flush out branched content? if (mBranchBuffer != null) { if (mInputLen > mBranchStartOffset) { appendBranched(mBranchStartOffset, mInputLen); } mBranchStartOffset = 0; } return super.readInto(reader); }
public boolean readMore(WstxInputData reader, int minAmount) throws IOException, XMLStreamException { // Existing data to output to branch? if (mBranchBuffer != null) { int ptr = reader.mInputPtr; int currAmount = mInputLast - ptr; if (currAmount > 0) { if (ptr > mBranchStartOffset) { appendBranched(mBranchStartOffset, ptr); } mBranchStartOffset = 0; } } return super.readMore(reader, minAmount); }
throw new WstxException("Reader (of type "+mReader.getClass().getName()+") returned 0 characters, even when asked to read up to "+mBuffer.length, getLocation());
/** * @param parent * @param entityName Name of the entity expanded to create this input * source: null when source created for the (main level) external * DTD subset entity. * @param xmlVersion Optional xml version identifier of the main parsed * document. Currently only relevant for checking that XML 1.0 document * does not include XML 1.1 external parsed entities. * If unknown, no checks will be done. */ public static ReaderSource constructEntitySource (ReaderConfig cfg, WstxInputSource parent, String entityName, InputBootstrapper bs, String pubId, SystemId sysId, int xmlVersion, Reader r) { // true -> do close the underlying Reader at EOF ReaderSource rs = new ReaderSource (cfg, parent, entityName, pubId, sysId, r, true); if (bs != null) { rs.setInputOffsets(bs.getInputTotal(), bs.getInputRow(), -bs.getInputColumn()); } return rs; }
@Override public void closeCompletely() throws IOException { /* Only need to call if the Reader is not yet null... since * buffer may have been cleaned by a call to close() */ if (mReader != null) { // so that it's ok to call multiple times closeAndRecycle(true); } }
public int readInto(WstxInputData reader) throws IOException, XMLStreamException { // Need to flush out branched content? if (mBranchBuffer != null) { if (mInputLast > mBranchStartOffset) { appendBranched(mBranchStartOffset, mInputLast); } mBranchStartOffset = 0; } return super.readInto(reader); }