diff options
Diffstat (limited to 'pdf-as-legacy/src/test/java/ByteArrayDataSink.java')
-rw-r--r-- | pdf-as-legacy/src/test/java/ByteArrayDataSink.java | 36 |
1 files changed, 36 insertions, 0 deletions
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(); + } + +} |