My favorites | Sign in
Project Logo
Project hosting will be READ-ONLY Wednesday at 8am PST due to brief network maintenance.
                
Code license: Apache License 2.0
Labels: java
Feeds:
People details
Project owners:
  denis.tsyplakov

Dumps Java object state into human readable format (similar, but not exact, to JavaFX literal). For example:

Dumper dmpr = new Dumper();
System.out.println(dmpr.dump(new Date()));

prints:

java.util.Date{
   cdate : null
   fastTime : 1218288272098
}

Another example:

Dumper dmpr = new Dumper();
dmpr.setRadix(16); //You could use radix up to Character.MAX_RADIX, 31 for example :-)
dmpr.setIDENT("\t");
dmpr.setMaxDepth(5); //In this particular example this parameter matter
System.out.println(dmpr.dump(new ByteArrayInputStream("123456789".getBytes())));

prints:

java.io.ByteArrayInputStream{
	buf : [ // byte[9]
		31h, 32h, 33h, 34h, 35h, 36h, 37h, 38h, 
		39h
	]
	count : 9h
	mark : 0h
	pos : 0h
}

Current status: v 1.5 is stable and is used in real project for 6 month.

Dumper dumps java objects using .toString() and has special format for dmping Map, List, Set, Date classes.

You could also take a look at BigExample

TODO:

  1. Make more settings (array width, in which form cycle ref's should be print, etc)
  2. Write JavaDoc, especially about settings
  3. Several ways to dump cyclic ref's
  4. Add set of field names that should be excluded from dump









Hosted by Google Code