Code example for Stack

Methods: add

0
public class CompositeReader extends Reader {
 
	Stack<Reader> readers;
	 
	public void add(Reader r) {
		readers.add(r);
	} 
	public CompositeReader() { 
		readers = new Stack<Reader>();
	} 
	public CompositeReader(Reader r) {
		this(); 
		add(r);
	} 
	 
	@Override 
	public int read(char[] cbuf, int off, int len) 
		throws IOException { 
		if(readers.size() == 0) return -1;
		Reader r = readers.peek();
		int n= -1;