Document doc;
while ((doc = docList.nextDocument()) != null) {
System.out.println();
for (String name : doc.getPropertyNames()) {
Property prop = doc.findProperty(name);
Value value;
while ((value = prop.nextValue()) != null) {
String printableValue;
if (value instanceof BinaryValue) {
try {
InputStream in = ((BinaryValue) value).getInputStream();
byte[] buffer = new byte[32];
int count = in.read(buffer);
in.close();
if (count == -1)
printableValue = "";
else
printableValue = new String(buffer, 0, count);
} catch (IOException e) {
printableValue = e.toString();
}
} else
printableValue = value.toString();
System.out.println(name + " = " + printableValue);
}
}
}
}