static XMLEventReader readOutputSender(OutputStreamSender sender) { try { if (sender == null) { return null; } ByteArrayOutputStream baos = new ByteArrayOutputStream(); sender.write(baos); return readBytes(baos.toByteArray()); } catch (IOException e) { throw new MarkLogicIOException(e); } } static XMLEventReader readReader(Reader reader) {
static XMLEventReader readOutputSender(OutputStreamSender sender) { try { if (sender == null) { return null; } ByteArrayOutputStream baos = new ByteArrayOutputStream(); sender.write(baos); return readBytes(baos.toByteArray()); } catch (IOException e) { throw new MarkLogicIOException(e); } } static XMLEventReader readReader(Reader reader) {
@Override public void writeTo(BufferedSink sink) throws IOException { OutputStream out = sink.outputStream(); if (logger != null) { OutputStream tee = logger.getPrintStream(); long max = logger.getContentMax(); if (tee != null && max > 0) { handle.write(new OutputStreamTee(out, tee, max)); return; } } handle.write(out); } }
} else if (content instanceof OutputStreamSender) { ByteArrayOutputStream bytesStream = new ByteArrayOutputStream(); ((OutputStreamSender) content).write(bytesStream); stringContent = bytesStream.toString("UTF-8"); } else if ( content instanceof byte[] ) {
} else if (content instanceof OutputStreamSender) { ByteArrayOutputStream buf = new ByteArrayOutputStream(); ((OutputStreamSender) content).write(buf); return new StreamSource( new ByteArrayInputStream(buf.toByteArray()));
} else if (content instanceof OutputStreamSender) { ByteArrayOutputStream buf = new ByteArrayOutputStream(); ((OutputStreamSender) content).write(buf); return new StreamSource( new ByteArrayInputStream(buf.toByteArray()));
Object value = handleBase.sendContent(); if ( value instanceof OutputStreamSender ) { ((OutputStreamSender) value).write(out); } else { out.write(HandleAccessor.contentAsString(options).getBytes("UTF-8"));