public void produceContent(final ContentEncoder enc, final IOControl ioc) throws IOException { if (content != null) { if (buffer == null) { if (content.getTempFile() == null) { buffer = ByteBuffer.wrap(content.getBytes()); } else { fis = content.getInputStream(); chan = (fis instanceof FileInputStream) ? ((FileInputStream)fis).getChannel() : Channels.newChannel(fis); buffer = ByteBuffer.allocate(8 * 1024); } } int i = -1; buffer.rewind(); if (buffer.hasRemaining() && chan != null) { i = chan.read(buffer); buffer.flip(); } enc.write(buffer); if (!buffer.hasRemaining() && i == -1) { enc.complete(); } } else { buf.produceContent(enc, ioc); } }
private void handleOutputStream(final LogEvent event, Message message, CachedOutputStream cos) throws IOException { String encoding = (String) message.get(Message.ENCODING); if (StringUtils.isEmpty(encoding)) { encoding = StandardCharsets.UTF_8.name(); } StringBuilder payload = new StringBuilder(); cos.writeCacheTo(payload, encoding, limit); cos.close(); event.setPayload(payload.toString()); boolean isTruncated = cos.size() > limit && limit != -1; event.setTruncated(isTruncated); event.setFullContentFile(cos.getTempFile()); }
private void handleOutputStream(final LogEvent event, Message message, CachedOutputStream cos) throws IOException { String encoding = (String) message.get(Message.ENCODING); if (StringUtils.isEmpty(encoding)) { encoding = StandardCharsets.UTF_8.name(); } StringBuilder payload = new StringBuilder(); cos.writeCacheTo(payload, encoding, limit); cos.close(); event.setPayload(payload.toString()); boolean isTruncated = cos.size() > limit && limit != -1; event.setTruncated(isTruncated); event.setFullContentFile(cos.getTempFile()); }
if (bos.getTempFile() != null) { buffer.getMessage().append("Filename: " + bos.getTempFile().getAbsolutePath() + "\n");
if (bos.getTempFile() != null) { buffer.getMessage().append("Filename: " + bos.getTempFile().getAbsolutePath() + "\n");
if (bos.getTempFile() != null) { buffer.getMessage().append("Filename: " + bos.getTempFile().getAbsolutePath() + "\n");
if (cos.getTempFile() == null) { buffer.getMessage().append("Filename: " + cos.getTempFile().getAbsolutePath() + "\n"); if (cos.size() >= lim) { buffer.getMessage().append("(message truncated to " + lim + " bytes)\n");
if (bos.getTempFile() != null) { buffer.getMessage().append("Filename: " + bos.getTempFile().getAbsolutePath() + "\n");
if (bos.getTempFile() != null) { buffer.getMessage().append("Filename: " + bos.getTempFile().getAbsolutePath() + "\n");
if (cos.getTempFile() == null) { buffer.getMessage().append("Filename: " + cos.getTempFile().getAbsolutePath() + "\n"); if (cos.size() >= lim) { buffer.getMessage().append("(message truncated to " + lim + " bytes)\n");
if (cos.getTempFile() == null) { buffer.getMessage().append("Filename: " + cos.getTempFile().getAbsolutePath() + "\n"); if (cos.size() >= lim) { buffer.getMessage().append("(message truncated to " + lim + " bytes)\n");
if (cos.getTempFile() == null) { buffer.getMessage().append("Filename: " + cos.getTempFile().getAbsolutePath() + "\n"); if (cos.size() >= lim) { buffer.getMessage().append("(message truncated to " + lim + " bytes)\n");
if (cos.getTempFile() == null) { buffer.getMessage().append("Filename: " + cos.getTempFile().getAbsolutePath() + "\n"); if (cos.size() >= lim) { buffer.getMessage().append("(message truncated to " + lim + " bytes)\n");