/** * @param in a reader providing vCard data * @param registry a group registry used to construct vCard objects * @param propertyFactoryRegistry a property factory registry used to construct * vCard objects * @param parameterFactoryRegistry a parameter factory registry used to construct * vCard objects */ public VCardBuilder(final Reader in, final GroupRegistry registry, final PropertyFactoryRegistry propertyFactoryRegistry, final ParameterFactoryRegistry parameterFactoryRegistry) { this.reader = new BufferedReader(new UnfoldingReader(in, BUFFER_SIZE), BUFFER_SIZE); this.groupRegistry = registry; this.propertyFactoryRegistry = propertyFactoryRegistry; this.parameterFactoryRegistry = parameterFactoryRegistry; this.relaxedParsing = CompatibilityHints.isHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING); }
/** * @param tokeniser * @param in * @return int value of the ttype field of the tokeniser */ private int getLineNumber(StreamTokenizer tokeniser, Reader in) { int line = tokeniser.lineno(); if (tokeniser.ttype == StreamTokenizer.TT_EOL) { line -= 1; } if (in instanceof UnfoldingReader) { // need to take unfolded lines into account final int unfolded = ((UnfoldingReader) in).getLinesUnfolded(); line += unfolded; } return line; }
/** * {@inheritDoc} */ public int read(final char[] cbuf, final int off, final int len) throws IOException { final int read = super.read(cbuf, off, len); boolean doUnfold = false; for (char[] pattern : patterns) { if (read > 0 && cbuf[0] == pattern[0]) { doUnfold = true; break; } else { for (int j = 0; j < read; j++) { if (cbuf[j] == pattern[0]) { unread(cbuf, j, read - j); return j; } } } } if (!doUnfold) { return read; } else { unread(cbuf, off, read); } unfold(); return super.read(cbuf, off, maxPatternLength); }
unread(buffers[i], 0, read); } else { if (log.isTraceEnabled()) {
unread(buffers[i], 0, read); } else { if (log.isTraceEnabled()) {
/** * @param in a reader providing vCard data * @param registry a group registry used to construct vCard objects * @param propertyFactoryRegistry a property factory registry used to construct * vCard objects * @param parameterFactoryRegistry a parameter factory registry used to construct * vCard objects */ public VCardBuilder(Reader in, GroupRegistry registry, PropertyFactoryRegistry propertyFactoryRegistry, ParameterFactoryRegistry parameterFactoryRegistry) { this.reader = new BufferedReader(new UnfoldingReader(in, BUFFER_SIZE), BUFFER_SIZE); this.groupRegistry = registry; this.propertyFactoryRegistry = propertyFactoryRegistry; this.parameterFactoryRegistry = parameterFactoryRegistry; this.relaxedParsing = CompatibilityHints.isHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING); }
/** * {@inheritDoc} */ public int read(final char[] cbuf, final int off, final int len) throws IOException { final int read = super.read(cbuf, off, len); boolean doUnfold = false; for (char[] pattern : patterns) { if (read > 0 && cbuf[0] == pattern[0]) { doUnfold = true; break; } else { for (int j = 0; j < read; j++) { if (cbuf[j] == pattern[0]) { unread(cbuf, j, read - j); return j; } } } } if (!doUnfold) { return read; } else { unread(cbuf, off, read); } unfold(); return super.read(cbuf, off, maxPatternLength); }
/** * @param tokeniser * @param in * @return int value of the ttype field of the tokeniser */ private int getLineNumber(StreamTokenizer tokeniser, Reader in) { int line = tokeniser.lineno(); if (tokeniser.ttype == StreamTokenizer.TT_EOL) { line -= 1; } if (in instanceof UnfoldingReader) { // need to take unfolded lines into account final int unfolded = ((UnfoldingReader) in).getLinesUnfolded(); line += unfolded; } return line; }
unread(buffers[i], 0, read); } else { if (log.isTraceEnabled()) {
/** * Builds an iCalendar model from the specified reader. An <code>UnfoldingReader</code> is applied to the * specified reader to ensure the data stream is correctly unfolded where appropriate. * * @param in a reader to read calendar data from * @return a calendar parsed from the specified reader * @throws IOException where an error occurs reading data from the specified reader * @throws ParserException where an error occurs parsing data from the reader */ public Calendar build(final Reader in) throws IOException, ParserException { return build(new UnfoldingReader(in)); }
/** * {@inheritDoc} */ public int read(final char[] cbuf, final int off, final int len) throws IOException { final int read = super.read(cbuf, off, len); boolean doUnfold = false; for (char[] pattern : patterns) { if (read > 0 && cbuf[0] == pattern[0]) { doUnfold = true; break; } else { for (int j = 0; j < read; j++) { if (cbuf[j] == pattern[0]) { unread(cbuf, j, read - j); return j; } } } } if (!doUnfold) { return read; } else { unread(cbuf, off, read); } unfold(); return super.read(cbuf, off, maxPatternLength); }
/** * @param tokeniser * @param in * @return int value of the ttype field of the tokeniser */ private int getLineNumber(StreamTokenizer tokeniser, Reader in) { int line = tokeniser.lineno(); if (tokeniser.ttype == StreamTokenizer.TT_EOL) { line -= 1; } if (in instanceof UnfoldingReader) { // need to take unfolded lines into account final int unfolded = ((UnfoldingReader) in).getLinesUnfolded(); line += unfolded; } return line; }
unread(buffers[i], 0, read); } else { if (log.isTraceEnabled()) {
/** * Builds an iCalendar model from the specified reader. An <code>UnfoldingReader</code> is applied to the * specified reader to ensure the data stream is correctly unfolded where appropriate. * * @param in a reader to read calendar data from * @return a calendar parsed from the specified reader * @throws IOException where an error occurs reading data from the specified reader * @throws ParserException where an error occurs parsing data from the reader */ public Calendar build(final Reader in) throws IOException, ParserException { return build(new UnfoldingReader(in)); }
/** * {@inheritDoc} */ public int read(final char[] cbuf, final int off, final int len) throws IOException { final int read = super.read(cbuf, off, len); boolean doUnfold = false; for (char[] pattern : patterns) { if (read > 0 && cbuf[0] == pattern[0]) { doUnfold = true; break; } else { for (int j = 0; j < read; j++) { if (cbuf[j] == pattern[0]) { unread(cbuf, j, read - j); return j; } } } } if (!doUnfold) { return read; } else { unread(cbuf, off, read); } unfold(); return super.read(cbuf, off, maxPatternLength); }
/** * @param tokeniser * @param in * @return */ private int getLineNumber(StreamTokenizer tokeniser, Reader in) { int line = tokeniser.lineno(); if (tokeniser.ttype == StreamTokenizer.TT_EOL) { line -= 1; } if (in instanceof UnfoldingReader) { // need to take unfolded lines into account final int unfolded = ((UnfoldingReader) in).getLinesUnfolded(); line += unfolded; } return line; } }
unread(buffers[i], 0, read);
/** * Builds an iCalendar model from the specified reader. An <code>UnfoldingReader</code> is applied to the * specified reader to ensure the data stream is correctly unfolded where appropriate. * * @param in a reader to read calendar data from * @return a calendar parsed from the specified reader * @throws IOException where an error occurs reading data from the specified reader * @throws ParserException where an error occurs parsing data from the reader */ public Calendar build(final Reader in) throws IOException, ParserException { return build(new UnfoldingReader(in)); }
/** * @param tokeniser * @param in * @return */ private int getLineNumber(StreamTokenizer tokeniser, Reader in) { int line = tokeniser.lineno(); if (tokeniser.ttype == StreamTokenizer.TT_EOL) { line -= 1; } if (in instanceof UnfoldingReader) { // need to take unfolded lines into account final int unfolded = ((UnfoldingReader) in).getLinesUnfolded(); line += unfolded; } return line; }