From 2436aa273f00dafb465c2342ea8e7297898915d2 Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Tue, 21 Jan 2014 09:57:16 +0100 Subject: Implementations for pdf-as-web and pdf-as-legacy --- pdf-as-legacy/src/test/java/ByteArrayDataSink.java | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 pdf-as-legacy/src/test/java/ByteArrayDataSink.java (limited to 'pdf-as-legacy/src/test/java/ByteArrayDataSink.java') diff --git a/pdf-as-legacy/src/test/java/ByteArrayDataSink.java b/pdf-as-legacy/src/test/java/ByteArrayDataSink.java new file mode 100644 index 00000000..7aa74333 --- /dev/null +++ b/pdf-as-legacy/src/test/java/ByteArrayDataSink.java @@ -0,0 +1,36 @@ +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.OutputStream; + +import at.gv.egiz.pdfas.api.io.DataSink; + + +public class ByteArrayDataSink implements DataSink { + + private ByteArrayOutputStream bos = new ByteArrayOutputStream(); + + public ByteArrayDataSink() { + } + + public OutputStream createOutputStream(String mimeType) throws IOException { + return createOutputStream(mimeType, "UTF-8"); + } + + public OutputStream createOutputStream(String mimeType, + String characterEncoding) throws IOException { + return bos; + } + + public String getMimeType() { + return "application/pdf"; + } + + public String getCharacterEncoding() { + return "UTF-8"; + } + + public byte[] getBytes() { + return this.bos.toByteArray(); + } + +} -- cgit v1.2.3