A while back I was working on a project using GWT, and in the process accumulated a set of libraries. The project went nowhere, but the libraries might be useful to someone, so I'm making them available here.

Cowj contains:

  • java.io (InputStreams, OutputStreams, Readers, Writers, Files)
  • java.nio (Buffers)
  • java.nio.charset (Character set conversion, although the set of supported encodings is pretty slim as they have to be written manually. Currently this is ASCII, UTF-8, CP1252, ISO-8859-1 and ISO-8859-15.)
  • java.nio.channel (All the abstract channel stuff, plus FileChannel)
  • java.util.zip (Complete, courtesy of JazzLib)
  • org.apache.commons.codec (Complete)
  • org.apache.commons.collections.primitives (Complete)
  • org.apache.james.mime4j (Most of it, although I did this before I had File so all the File support has been removed)

...and a few other bits and pieces. It's all very patchy and I've had tinker with pretty much all of it to make it work, but there's enough functionality there to make porting traditional Java software vastly easier.

Cowj's File support is based on a very simple in-memory file system which has no directories and no persistence. It's good enough to create temporary files and then use them later.

You also get:

  • Jagg, a pure-Java port of the Antigrain Geometry lightweight renderer. This is a software canvas implementation that will draw closed polygons of arbitrary complexity into an off-screen buffer, with full alpha blending and subpixel rendering. I've also glued on Adam Doppelt's GIFEncoder so the result can be turned into a data: URL for display. (Although this only works with images with up to 256 colours.)

None of it's at all documented, but it's all modular and should be easy enough to work. And best of all, it's all available under a rather complex set of compatible licenses; see inside the package for details, but the bulk of it is released under the terms of the Apache 2.0 license.

Cowj demo

Everyone loves demos! Here's a ZIP file viewer implemented entirely client-side. This uses HTML5 FileReader to read the files from local storage; then it stores them in Cowj's VFS; then it opens the file using a completely standard ZipFile object. Downloading the decompressed contents is done by using Apache Codecs to convert the contents to Base64 to make a data scheme link.


The download package.