1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 package org.apache.maven.doxia.util; 20 21 import org.apache.maven.doxia.parser.ParseException; 22 23 /** 24 * The token are the new lines :) 25 * 26 * @author Juan F. Codagnone 27 * @since Nov 4, 2005 28 */ 29 public interface ByLineSource { 30 /** 31 * <p>getNextLine.</p> 32 * 33 * @return the next line. <code>null</code> if we reached the end. 34 * @throws org.apache.maven.doxia.parser.ParseException on I/O error 35 */ 36 String getNextLine() throws ParseException; 37 38 /** 39 * <p>getName.</p> 40 * 41 * @return the name of the input. could be the filename for example. 42 */ 43 String getName(); 44 45 /** 46 * <p>getLineNumber.</p> 47 * 48 * @return the current line number. 49 */ 50 int getLineNumber(); 51 52 /** 53 * <p>ungetLine.</p> 54 * 55 * This should throw a java.lang.IllegalStateException if called more than 56 * one time without calling getNextLine(). 57 */ 58 void ungetLine(); 59 60 /** 61 * <p>unget.</p> 62 * 63 * @param s some text to push back to the parser. 64 * This should throw a java.lang.IllegalStateException if called more than 65 * one time without calling getNextLine(). 66 */ 67 void unget(String s); 68 69 /** 70 * close the source. 71 */ 72 void close(); 73 }