moved from util.input -> inputConsole. Added InputConsole.getVersion()

This commit is contained in:
nathan 2016-02-10 19:28:43 +01:00
parent 920d0d87bd
commit 8aa993c04f
12 changed files with 35 additions and 25 deletions

View File

@ -37,7 +37,7 @@ This project is **kept in sync** with the utilities library, so "jar hell" is no
<dependency> <dependency>
<groupId>com.dorkbox</groupId> <groupId>com.dorkbox</groupId>
<artifactId>InputConsole</artifactId> <artifactId>InputConsole</artifactId>
<version>1.5</version> <version>2.0</version>
</dependency> </dependency>
``` ```
@ -50,3 +50,5 @@ https://oss.sonatype.org/content/repositories/releases/com/dorkbox/InputConsole-
This project is distributed under the terms of the Apache v2.0 License. See file "LICENSE" for further references. This project is distributed under the terms of the Apache v2.0 License. See file "LICENSE" for further references.

View File

@ -9,7 +9,7 @@
* @author <a href="mailto:jason@planet57.com">Jason Dillon</a> * @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
* @author <a href="mailto:gnodet@gmail.com">Guillaume Nodet</a> * @author <a href="mailto:gnodet@gmail.com">Guillaume Nodet</a>
*/ */
package dorkbox.util.input; package dorkbox.inputConsole;
import java.nio.charset.Charset; import java.nio.charset.Charset;

View File

@ -13,15 +13,15 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.util.input; package dorkbox.inputConsole;
import dorkbox.inputConsole.posix.UnixTerminal;
import dorkbox.inputConsole.unsupported.UnsupportedTerminal;
import dorkbox.objectPool.ObjectPool;
import dorkbox.util.OS; import dorkbox.util.OS;
import dorkbox.util.bytes.ByteBuffer2; import dorkbox.util.bytes.ByteBuffer2;
import dorkbox.util.bytes.ByteBuffer2Poolable; import dorkbox.util.bytes.ByteBuffer2Poolable;
import dorkbox.util.input.posix.UnixTerminal; import dorkbox.inputConsole.windows.WindowsTerminal;
import dorkbox.util.input.unsupported.UnsupportedTerminal;
import dorkbox.util.input.windows.WindowsTerminal;
import dorkbox.util.objectPool.ObjectPool;
import org.fusesource.jansi.Ansi; import org.fusesource.jansi.Ansi;
import org.fusesource.jansi.AnsiConsole; import org.fusesource.jansi.AnsiConsole;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -87,6 +87,14 @@ class InputConsole {
} }
} }
/**
* Gets the version number.
*/
public static
String getVersion() {
return "2.0";
}
/** /**
* return null if no data * return null if no data
*/ */
@ -568,3 +576,4 @@ class InputConsole {
// return sbuff; // return sbuff;
} }
} }

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.util.input; package dorkbox.inputConsole;
import java.io.IOException; import java.io.IOException;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.util.input; package dorkbox.inputConsole;
public class TerminalType { public class TerminalType {
public static final String TYPE = "input.terminal"; public static final String TYPE = "input.terminal";

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.util.input.posix; package dorkbox.inputConsole.posix;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;

View File

@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.util.input.posix; package dorkbox.inputConsole.posix;
import java.nio.ByteBuffer;
import com.sun.jna.Library; import com.sun.jna.Library;
import java.nio.ByteBuffer;
@SuppressWarnings("ALL") @SuppressWarnings("ALL")
interface PosixTerminalControl extends Library { interface PosixTerminalControl extends Library {

View File

@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.util.input.posix; package dorkbox.inputConsole.posix;
import com.sun.jna.Structure;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import com.sun.jna.Structure;
@SuppressWarnings("ALL") @SuppressWarnings("ALL")
class TermiosStruct extends Structure { class TermiosStruct extends Structure {
/** /**

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.util.input.posix; package dorkbox.inputConsole.posix;
import java.io.IOException; import java.io.IOException;
import java.io.Reader; import java.io.Reader;
@ -21,8 +21,8 @@ import java.nio.ByteBuffer;
import com.sun.jna.Native; import com.sun.jna.Native;
import dorkbox.util.input.Encoding; import dorkbox.inputConsole.Encoding;
import dorkbox.util.input.Terminal; import dorkbox.inputConsole.Terminal;
/** /**
* Terminal that is used for unix platforms. Terminal initialization is handled via JNA and ioctl/tcgetattr/tcsetattr/cfmakeraw. * Terminal that is used for unix platforms. Terminal initialization is handled via JNA and ioctl/tcgetattr/tcsetattr/cfmakeraw.

View File

@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.util.input.unsupported; package dorkbox.inputConsole.unsupported;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import dorkbox.inputConsole.Terminal;
import dorkbox.util.bytes.ByteBuffer2; import dorkbox.util.bytes.ByteBuffer2;
import dorkbox.util.input.Terminal;
public class UnsupportedTerminal extends Terminal { public class UnsupportedTerminal extends Terminal {

View File

@ -9,7 +9,7 @@
* @author <a href="mailto:mwp1@cornell.edu">Marc Prud'hommeaux</a> * @author <a href="mailto:mwp1@cornell.edu">Marc Prud'hommeaux</a>
* @author <a href="mailto:jason@planet57.com">Jason Dillon</a> * @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
*/ */
package dorkbox.util.input.windows; package dorkbox.inputConsole.windows;
/** /**
* Console mode * Console mode

View File

@ -9,17 +9,16 @@
* @author <a href="mailto:mwp1@cornell.edu">Marc Prud'hommeaux</a> * @author <a href="mailto:mwp1@cornell.edu">Marc Prud'hommeaux</a>
* @author <a href="mailto:jason@planet57.com">Jason Dillon</a> * @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
*/ */
package dorkbox.util.input.windows; package dorkbox.inputConsole.windows;
import java.io.IOException; import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import dorkbox.inputConsole.Terminal;
import org.fusesource.jansi.internal.Kernel32.INPUT_RECORD; import org.fusesource.jansi.internal.Kernel32.INPUT_RECORD;
import org.fusesource.jansi.internal.Kernel32.KEY_EVENT_RECORD; import org.fusesource.jansi.internal.Kernel32.KEY_EVENT_RECORD;
import org.fusesource.jansi.internal.WindowsSupport; import org.fusesource.jansi.internal.WindowsSupport;
import dorkbox.util.input.Terminal;
/** /**
* Terminal implementation for Microsoft Windows. Terminal initialization in {@link #init} is accomplished by calling the Win32 APIs <a * Terminal implementation for Microsoft Windows. Terminal initialization in {@link #init} is accomplished by calling the Win32 APIs <a
* href="http://msdn.microsoft.com/library/default.asp? url=/library/en-us/dllproc/base/setconsolemode.asp">SetConsoleMode</a> and <a * href="http://msdn.microsoft.com/library/default.asp? url=/library/en-us/dllproc/base/setconsolemode.asp">SetConsoleMode</a> and <a