for (Map.Entry<String, Object> entry: documents.entrySet()) { out.writeUTF(entry.getKey()); cs.writeContent(out, entry.getValue());
@Override @SuppressWarnings({ "unchecked", "rawtypes" }) public void writeData(ObjectDataOutput out) throws IOException { super.writeData(out); boolean compress = Boolean.parseBoolean(context.getProperty(pn_document_compress, "false")); String format = context.getProperty(pn_document_data_format); if (format != null) { ContentSerializer cs = repo.getSerializer(format); if (cs != null) { if (compress) { writeCompressedContent(out, cs, content); } else { cs.writeContent(out, content); } return; } } if (compress) { writeCompressedData(out, content); } else { out.writeObject(content); } }
public static void writeCompressedContent(ObjectDataOutput out, ContentSerializer<Object> cs, Object data) throws IOException { InternalSerializationService ss = (InternalSerializationService) out.getSerializationService(); ObjectDataOutput tmp = ss.createObjectDataOutput(); cs.writeContent(tmp, data); out.writeByteArray(IOUtil.compress(tmp.toByteArray())); } }
protected void writeContent(ObjectDataOutput out) throws IOException { if (repo == null) { repo = getRepository(); } if (repo != null) { ContentSerializer cs = repo.getSerializer(contentType); if (cs != null) { out.writeBoolean(true); cs.writeContent(out, content); return; } } out.writeBoolean(false); out.writeObject(content); }