http://stackoverflow.com/questions/3477962/when-do-we-need-decorator-pattern
It really isn't specific to jsonrpc4j at all - it's just the
decorator pattern. All of java's streams inherit from InputStream
or OutputStream and usually have a constructor that takes an
implementation of the other. ie:
OutputStream out = new FileOutputStream("file.txt.gz");
out.write("not compressed'.getBytes());
out = new GZIPOutputStream(out);
out.write("compressed'.getBytes());
Here's an example with the client:
// setup client
JsonRpcClient client = ...;
// setup stream
OutputStream out = ...;
GZIPOutputStream compressedOut = new GZIPOutputStream(out);
// invoke
client.invoke("someMethod", arg, compressedOut);