return broker.getBinaryResourceData((BinaryDocument) doc);
return broker.getBinaryResource( (BinaryDocument) doc );
    public byte[] getBinaryResource(java.lang.String sessionId, java.lang.String name) throws java.rmi.RemoteException {        DBBroker broker = null;		Session session = getSession(sessionId);        DocumentImpl doc = null;        try {            broker = pool.get(session.getUser());            doc = (DocumentImpl) broker.openDocument(name, Lock.READ_LOCK);            if (doc == null)                throw new EXistException("Resource " + name + " not found");            if (doc.getResourceType() != DocumentImpl.BINARY_FILE)                throw new EXistException("Document " + name                        + " is not a binary resource");            if(!doc.getPermissions().validate(session.getUser(), Permission.READ))                throw new PermissionDeniedException("Insufficient privileges to read resource");            return broker.getBinaryResourceData((BinaryDocument) doc);        } catch (Exception ex) {        	throw new RemoteException(ex.getMessage());        } finally {            if(doc != null)                doc.getUpdateLock().release(Lock.READ_LOCK);            pool.release(broker);        }    }