}
public boolean getBin(DBBroker broker,String suffix)
throws Exception
{
BinaryDocument binDoc = null;
try {
Collection top = broker.getCollection(XmldbURI.create("xmldb:exist:///"));
System.out.println("count="+top.getDocumentCount(broker));
MutableDocumentSet docs = new DefaultDocumentSet();
top.getDocuments(broker,docs);
XmldbURI [] uris = docs.getNames();
for (int i=0; i<uris.length; i++) {
System.out.println(i+": "+uris[i].toString());
}
//binDoc = (BinaryDocument)broker.getXMLResource(XmldbURI.create("xmldb:exist:///bin"),Lock.READ_LOCK);
binDoc = (BinaryDocument)top.getDocument(broker,XmldbURI.create("xmldb:exist:///bin"));
top.release(Lock.READ_LOCK);
assertTrue(binDoc!=null);
ByteArrayOutputStream os = new ByteArrayOutputStream();
broker.readBinaryResource(binDoc,os);
String comp = os.size()>0 ? new String(os.toByteArray()) : "";
System.out.println("Got: "+comp);
return comp.equals(bin+suffix);
} finally {
if (binDoc!=null) {
binDoc.getUpdateLock().release(Lock.READ_LOCK);
}
}
}