I often create `dump' method. However, it is not specific code but routine code.
Thus, I am tiresome.
This library supports that routine code.
API Document [No Frames] Sorry, Japanese only.
GNU Lesser General Public License
Link about LGPL
tar.gz archive.
extract dump-x.x.x.tar.gz.
$ gzip -cd dump-x.x.x.tar.gz | tar xvf -
Then you can see dump-x.x.x directory.
Use dump.jar on dump-x.x.x/lib directory.
You define the class which implements Dumpable interface.
And you may obtain Dumper object from DumperFactory class.
If you wish dumping object, then you would call
Dumper#dump(com.oikaze.tama.dump.Dumpable) method.
Example as follows.
public class SampleDumper implements Dumper{
public String getName(){ return "sample"; }
public void dump(OutputStream out) throws IOException{
out.write("sample data".getBytes());
}
}
SampleDumpable sample = new SampleDumpable();
Dumper dumper = DumperFactory.getInstance().getDumper("hoge");
dumper.dump(sample);
dumper.close();
Above sample output data("sample data") to "hoge/sample" file. By the way, following sample output data to "hoge.zip" file with zip format. zip file entry is "sample".
SampleDumpable sample = new SampleDumpable();
Dumper dumper = DumperFactory.getInstance().getDumper("hoge.zip");
dumper.dump(sample);
And, following sample output data to memory. Thus, you can obtain byte array from `getByteArray` method.
SampleDumpable sample = new SampleDumpable();
Dumper dumper = DumperFactory.getInstance().getDumper("<memory>");
dumper.dump(sample);
byte[] data = ((MemoryDumper)dumper).getByteArray();
dumper.close();
Create Filter
For example, you output with FileDumper,
it compress with gzip format.
| Contents |
|---|
| Link |
| Contents |
| ¥ê¥ó¥¯ |