About

Jadira is the home for Sousan and Chris Pheby's open source projects. These are reusable open source Java modules that provide first class solutions using the most effective current JEE technologies.

Search
Tag Cloud
...
Login
« Spring, Hibernate and JTA - A Better Integration | Main | Fixing Netflix Errors N8156-6013 and N8156-6023 with Firefox »
Saturday
Apr192014

Classes for IO

Jadira 3.2.0.GA will introduce some new classes for IO as part of a jadira-lang module. See JDF-77.

These address adapting NIO and traditional Java IO streams, optimised Buffered Stream inplementations, and an extension of the SAX InputSource that supports a variety of Source providers including the Spring Resource abstraction.

IO2NIO

This package provides two classes. ByteBufferBackedOutputStream is a custom OutputStream that writes to a ByteBuffer. ByteBufferBackedInputStream exposes reading from a ByteBuffer via an InputStream.

Core

I have frequently had the need to create similar classes to this one, so its well overdue to include it into Jadira. The class is a subclass of SAXInputSource. Its key feature is the variety of types from which the InputSource can be constructed - constructors are provided for File, InputStream, InputStreamSource, Resource (from Spring Framework) and URL.

Buffered

This package provides classes intended to be be used as an alternative to BufferedInputStream and BufferedOutputStream. Unlike those JDK classes they do not provide synchronization of their methods.

The following classes are provided for InputStream capabilities:

AbstractBufferedInputStream provides base functionality. It recreates some functionality from BufferedInputStream, but is organised to facilitate extendability. Whilst it does not subclass BufferedInputStream it instead subclasses FilterInputStream (the superclass of BufferedInputStream), so can be used in many of the same places.

Three subclasses exist, these are backed by DirectByteBuffer, ByteBuffer and a byte array respectively.

For OutputStream, equivalent buffered classes are provided with similar properties:

PrintView Printer Friendly Version

EmailEmail Article to Friend

References (2)

References allow you to track sources for this article, as well as articles that were written in response to this article.

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>