001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.maven.doxia.util; 020 021import org.apache.maven.doxia.parser.ParseException; 022 023/** 024 * The token are the new lines :) 025 * 026 * @author Juan F. Codagnone 027 * @since Nov 4, 2005 028 */ 029public interface ByLineSource { 030 /** 031 * <p>getNextLine.</p> 032 * 033 * @return the next line. <code>null</code> if we reached the end. 034 * @throws org.apache.maven.doxia.parser.ParseException on I/O error 035 */ 036 String getNextLine() throws ParseException; 037 038 /** 039 * <p>getName.</p> 040 * 041 * @return the name of the input. could be the filename for example. 042 */ 043 String getName(); 044 045 /** 046 * <p>getLineNumber.</p> 047 * 048 * @return the current line number. 049 */ 050 int getLineNumber(); 051 052 /** 053 * <p>ungetLine.</p> 054 * 055 * This should throw a java.lang.IllegalStateException if called more than 056 * one time without calling getNextLine(). 057 */ 058 void ungetLine(); 059 060 /** 061 * <p>unget.</p> 062 * 063 * @param s some text to push back to the parser. 064 * This should throw a java.lang.IllegalStateException if called more than 065 * one time without calling getNextLine(). 066 */ 067 void unget(String s); 068 069 /** 070 * close the source. 071 */ 072 void close(); 073}