doc = new DocumentImpl(broker, this);
resourceType = istream.readByte(); switch (resourceType) { case DocumentImpl.XML_FILE : doc = new DocumentImpl(broker, this); break; case DocumentImpl.BINARY_FILE : doc = new BLOBDocument(broker, this); break; default : throw new IOException("unable to determine document type"); }
	public void read(DBBroker broker, VariableByteInputStream istream)		throws IOException {		collectionId = istream.readShort();		final int collLen = istream.readInt();		String sub;		for (int i = 0; i < collLen; i++)			subcollections.put(istream.readUTF(), istream.readLong());		final SecurityManager secman =			broker.getBrokerPool().getSecurityManager();		final int uid = istream.readInt();		final int gid = istream.readInt();		final int perm = (istream.readByte() & 0777);		if (secman == null) {			permissions.setOwner(SecurityManager.DBA_USER);			permissions.setGroup(SecurityManager.DBA_GROUP);		} else {			permissions.setOwner(secman.getUser(uid));			permissions.setGroup(secman.getGroup(gid).getName());		}		permissions.setPermissions(perm);		created = istream.readLong();		DocumentImpl doc;		try {			while (istream.available() > 0) {				doc = new DocumentImpl(broker, this);				doc.read(istream);				addDocument(broker, doc);			}		} catch (EOFException e) {		}	}