2 * This file is part of lanterna (http://code.google.com/p/lanterna/).
4 * lanterna is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 * Copyright (C) 2010-2015 Martin
19 package com
.googlecode
.lanterna
.input
;
21 import java
.io
.IOException
;
24 * Objects implementing this interface can read character streams and transform them into {@code Key} objects which can
25 * be read in a FIFO manner.
29 public interface InputProvider
{
31 * Returns the next {@code Key} off the input queue or null if there is no more input events available. Note, this
32 * method call is <b>not</b> blocking, it returns null immediately if there is nothing on the input stream.
33 * @return Key object which represents a keystroke coming in through the input stream
34 * @throws java.io.IOException Propagated error if the underlying stream gave errors
36 KeyStroke
pollInput() throws IOException
;
39 * Returns the next {@code Key} off the input queue or blocks until one is available. <b>NOTE:</b> In previous
40 * versions of Lanterna, this method was <b>not</b> blocking. From lanterna 3, it is blocking and you can call
41 * {@code pollInput()} for the non-blocking version.
42 * @return Key object which represents a keystroke coming in through the input stream
43 * @throws java.io.IOException Propagated error if the underlying stream gave errors
45 KeyStroke
readInput() throws IOException
;