StringEditor { public void write(String data, long timestamp, String message) throws DigitalObjectException { try { editor.write(data.getBytes("UTF-8"), timestamp, message); } catch (IOException ex) { throw new DigitalObjectException(object.getPid(), ex); } } StringEditor(FedoraObject object, DatastreamProfile profile);   StringEditor(XmlStreamEditor editor, FedoraObject object); static StringEditor ocr(FedoraObject object); static StringEditor ocr(FedoraObject object, boolean storeExternally); static DatastreamProfile ocrProfile(); static StringEditor privateNote(FedoraObject object); static DatastreamProfile privateNoteProfile(); String read(); StringRecord readRecord(); void write(String data, long timestamp, String message); static void copy(File source, String sourceCharset, File target, String targetCharset); long getLastModified(); static final String OCR_ID; static final String OCR_LABEL; static final String PRIVATE_NOTE_ID; static final String PRIVATE_NOTE_LABEL; }
@Test public void testWrite() throws Exception { LocalStorage storage = new LocalStorage(); LocalObject local = storage.create(); StringEditor instance = StringEditor.ocr(local); final String content = "ocr"; instance.write(content, 0, null); local.flush(); StringRecord result = instance.readRecord(); assertNotNull(result); assertEquals(content, result.getContent()); assertEquals(local.getPid(), result.getPid()); instance.write("update", result.getTimestamp(), null); }