Commit Graph

39 Commits

Author SHA1 Message Date
Joanthan Bernard
d5cf9a8afb Bugfix in ConsoleColor: always explicitly set boldness.
Always explicitly set the bold parameter 0 for normal, 1 for bold. Once set,
the text remains bold even after a color change until it is explicitly set back
to normal.
2014-11-21 16:01:00 -06:00
Joanthan Bernard
3f1b89aeac Added ConsoleColor class for creating ANSI color escape codes. 2014-11-21 15:18:09 -06:00
Joanthan Bernard
8e1ed220fd Fixed version in project.properties. 2014-11-21 10:17:29 -06:00
Jonathan Bernard
9887402b57 Merge. 2014-11-19 11:54:06 -06:00
Jonathan Bernard
14332b878c Added a LightOptionParser.parseOptions overload that accepts String[]. 2014-10-29 19:33:04 -05:00
Jonathan Bernard
4ab4e5876b Rewrite LightOptionParser to support multiple parameter arguments.
* LightOptionParser will only make one pass through the arguments array.
* Make LOP support multiple instances of an option (-i in1 -i in2)
* Make LOP support indeterminate option argument lengths
  (using arguments: "variable" in the definition).
* Add unit tests for LightOptionParser and a testing phase during the `package`
  build target.
2014-10-28 01:58:51 -05:00
Jonathan Bernard
8ab35b27bd HttpContext response return integer status values, not strings. 2014-09-25 02:33:26 -05:00
Jonathan Bernard
0494b53108 Enhancements to HTTPContext
* Default port is no 80.
* Support for HTTP Basic Authentication.
* Support for HTTPS.
* Support for Content-Type. Defaults to "applicaion/json" but also supports
  passing a map to be encoded as "application/x-www-form-urlencoded".
2014-09-21 07:05:52 -05:00
Jonathan Bernard
45f49d393e Added Content-Type header for POST request with HttpContext. 2014-01-11 18:56:16 -06:00
Jonathan Bernard
3929968af1 HttpContext: Added support for Transfer-Encoding: chunked 2013-09-21 02:28:24 -05:00
Jonathan Bernard
3fcc28d4ed Bugfix in LightOptionParser when handling undefined options. 2013-08-18 15:43:48 -05:00
Jonathan Bernard
3668a9e112 NonBlockingInputStreamReader is now pausable.
* NonBlockingInputStreamReader now has pause() and resume(). The reader will
  stop listening to input when pause() is invoked and will skip all available
  input once resume() is invoked, ignoring any buffered input entered while it
  was paused.
* Bumped the version to 2.0. This version change should have been made instead
  of 1.11, as that was a breaking change, altering the package name of several
  classes.
2013-08-10 01:21:13 -05:00
Jonathan Bernard
b47ca10660 Bugfixes for NonBlockingInputStreamReader. 2013-08-08 22:37:04 -05:00
Jonathan Bernard
7c8a3be4ac Bump version for latest changes. 2013-08-08 20:05:44 -05:00
Jonathan Bernard
3f50b81362 Reorganized IO utils. Added NonBlockingInputStreamReader 2013-08-08 19:55:15 -05:00
Jonathan Bernard
db15eb8f88 HttpContext: Lightweight HTTP protocol support. 2013-03-14 04:50:43 -05:00
Jonathan Bernard
c887a49f8c Added LightOptionParser, NullOutputStream, bugfixes.
LightOptionParser
-----------------

Lightweight, fairly featureful option parsing mechanism idiomatic to Groovy.
Takes in a map of parameter definitions and returns a map of option values and
arguments.

NullOutputStream
----------------

Ignores all data sent its way.

ParameterizedSocket
-------------------

Added trace and debug logging to the message handling code.

SmartConfig
-----------

Fixed a bug where a property lookup on a non-existent property with no default
given caused a null pointer exception trying to resolve the class of the default
value.
2012-11-27 08:40:17 -06:00
Jonathan Bernard
a186d6a09d LoggerOutputStream: Trimmed extra newlines before logging. 2012-11-22 16:02:56 -06:00
Jonathan Bernard
b9fa0d0bbf LoggerOutputStream bugfix, ParameterizedSocket changes.
ParameterizedSocket
-------------------

Moved from transmitting a list of strings (represented by ASCII data separated
by ASCII record separators `0x1E`) to a combination of strings and paired
strings. Basically, instead of each record being processed as a whole, a record
may optionall contain the ASCII unit separator `0x1F`. If it does, the record
will be split and treated as a key-value pair. This is implemented in the
`ParameterizedSocket.Message` class.o

LoggerOutputStream
------------------

Was not initializing the internal buffer.
2012-11-22 15:24:55 -06:00
Jonathan Bernard
21cdf6909c Added ParameterizedSocket and LoggerOutputStream classes.
ParameterizedSocket
-------------------

This is a wrapper around the basic java.net.Socket class that supports sending
and receiving messages with parameters. It exposes two methods:
`void sendMessage(String... message)` and `String[] receiveMessage()`. The
line-level format of the message is:

    START_TOKEN param [SEPARATOR param ...] END_TOKEN

Where `START_TOKEN` is the ASCII "Start heading" control code `0x01`,
`SEPARATOR` is the ASCII "record separator" code `0x1E`, and `END_TOKEN` is the
ASCII "end of transmission" code `0x03`.

LoggerOutputStream
------------------

An OutputStream implementation that flushes to an org.slf4j.Logger instance.
The log level is configurable. It is important to note that data written to
the stream accumulates in an internal buffer until `flush()` is called. At this
point the data is written out as one log message to the logger. It is expected
that one would wrap this stream in an auto-flushing PrintStream or PrintWriter
in actual use.
2012-11-21 13:33:15 -06:00
Jonathan Bernard
01c2f4930a ExtRobot: added default delay time, bugfix. 2012-11-21 13:32:46 -06:00
Jonathan Bernard
d2706e30bb Moved to common build v1.10 2012-11-21 13:32:07 -06:00
Jonathan Bernard
d185cfb4dd Added ExtRobot: extensions to Java Robot class. 2012-11-11 18:23:19 -06:00
Jonathan Bernard
82b0afc490 Bugfix to build script.
In the future it would be wise to upgrade to the latest version of the common
build script.
2012-11-11 18:20:28 -06:00
Jonathan Bernard
e12a605b5c Added JarUtils: programatically extract JAR files. 2012-01-02 15:08:26 -06:00
Jonathan Bernard
2308280480 Bugfix.
Default behavior in SmartConfig was wrong. What it should be (and now is) is
when a value is requested but not present, the value is set and returned with
the default if given, or null is returned if no default is given.
2011-12-05 22:18:26 -06:00
Jonathan Bernard
1227d53a14 Small updates to SmartConfig.
* Changed the behavior of SmartConfig when setting file type properties. Now it
  tries to coerce the given value into a File object if it is not already a File
  object.
* Changed the behavior of SmartConfig when retrieving a property without
  specifying a default value. Now it returns null if the property is not set and
  no default is given.
2011-12-05 22:12:20 -06:00
Jonathan Bernard
08810e88ed Added WrappedPrinter, SmartConfig.load()
* Added `SmartConfig.load()` to allow runtime reloading of config.
* Added `WrappedPrinter` which allows you to print horizontally aligned and
  offset text blocks in a monotype environment.
2011-10-25 15:05:02 -05:00
Jonathan Bernard
2950bd67db Added ConsoleProgressBar. 2011-01-25 15:56:02 -06:00
Jonathan Bernard
9457a6b7dd Really added keySet(). 2011-01-21 16:13:26 -06:00
Jonathan Bernard
7b3be90fe1 Updated SmartConfig
Added support for file/directory property types.
Removed some extraneous logging checks.
2011-01-21 14:03:05 -06:00
Jonathan Bernard
2d7e8e67ca Updated common build script. 2011-01-21 13:43:54 -06:00
Jonathan Bernard
b19d1cbe80 Updated SmartConfig, added keySet() method. 2011-01-21 13:41:29 -06:00
Jonathan Bernard
df8fcac2d2 Added slf4j, needed for SmartConfig to build. 2011-01-21 13:01:04 -06:00
Jonathan Bernard
9a179af663 Implementation of SmartConfig 2011-01-21 12:58:35 -06:00
Jonathan Bernard
10b1b15a4a Version 1.0 committed using standard build process. 2011-01-21 11:33:24 -06:00
Jonathan Bernard
8a6181fc84 Upgraded common build script. 2011-01-21 11:21:03 -06:00
Jonathan Bernard
2b256c1d27 Added standard build process. 2011-01-21 11:14:27 -06:00
Jonathan Bernard
2f79d7e1a3 Initial commit. 2010-10-15 10:00:20 -05:00