@Override public String toString() { return Json.write(value); } }
protected void write( Document document, OutputStream stream ) throws IOException { Json.write(document, stream); }
@Override public String toString() { return Json.write(this); }
/** * Writes document content to the stream. * * @param out output stream. * @throws IOException */ public void write(OutputStream out) throws IOException { Json.write(document, out); }
/** * {@inheritDoc} * * @see java.lang.Object#toString() */ @Override public String toString() { return Json.write(doc); }
@Override public String toString() { return Json.write(value); } }
/** * {@inheritDoc} * * @see java.lang.Object#toString() */ @Override public String toString() { return Json.write(doc); }
@Override public String toString() { return Json.write(this); }
@Override public String toString() { return Json.write(this); }
protected void write( Document document, OutputStream stream ) throws IOException { Json.write(document, stream); }
@Override public String toString() { return Json.write(this); }
@Override public String toString() { return Json.write(this); }
@Override public String toString() { return Json.write(this); }
stream = new BufferedOutputStream(fileStream); Json.write(document, stream);
stream = new BufferedOutputStream(fileStream); Json.write(document, stream);
protected void writeToChangedArea( Iterable<BinaryKey> unusedBinaries ) { LOGGER.debug("Writing unused binaries to change area of backup for {0} repository at {1}", repositoryName(), backupLocation()); File file = new File(changeDirectory, SUMMARY_FILE_NAME); try { EditableDocument doc = Schematic.newDocument(); EditableArray keys = doc.setArray(FieldName.UNUSED_BINARY_KEYS); for (BinaryKey key : unusedBinaries) { if (key != null) keys.add(key.toString()); } OutputStream outputStream = new FileOutputStream(file); try { Json.write(doc, outputStream); outputStream.flush(); } finally { outputStream.close(); } } catch (Throwable t) { problems.addError(JcrI18n.problemsWritingDocumentToBackup, file.getAbsolutePath(), t.getMessage()); } }
protected void writeToChangedArea( Iterable<BinaryKey> unusedBinaries ) { LOGGER.debug("Writing unused binaries to change area of backup for {0} repository at {1}", repositoryName(), backupLocation()); File file = new File(changeDirectory, SUMMARY_FILE_NAME); try { EditableDocument doc = Schematic.newDocument(); EditableArray keys = doc.setArray(FieldName.UNUSED_BINARY_KEYS); for (BinaryKey key : unusedBinaries) { if (key != null) keys.add(key.toString()); } OutputStream outputStream = new FileOutputStream(file); try { Json.write(doc, outputStream); outputStream.flush(); } finally { outputStream.close(); } } catch (Throwable t) { problems.addError(JcrI18n.problemsWritingDocumentToBackup, file.getAbsolutePath(), t.getMessage()); } }
@Test public void shouldReadExampleBsonStream() throws IOException { // "\x16\x00\x00\x00\x02hello\x00\x06\x00\x00\x00world\x00\x00" byte[] bytes = new byte[] {0x16, 0x00, 0x00, 0x00, 0x02, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x00, 0x06, 0x00, 0x00, 0x00, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x00, 0x00}; output = reader.read(new ByteArrayInputStream(bytes)); String json = Json.write(output); String expected = "{ \"hello\" : \"world\" }"; if (print) { System.out.println(json); System.out.flush(); } assertEquals(expected, json); }