aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-legacy/src/test/java/ByteArrayDataSink.java
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-01-21 09:57:16 +0100
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-01-21 09:57:16 +0100
commit2436aa273f00dafb465c2342ea8e7297898915d2 (patch)
tree27cf115b4ec6d36f84b01b50acc403cf31b3ab6b /pdf-as-legacy/src/test/java/ByteArrayDataSink.java
parent8d801ab37834b0f11c6a16c240d77da71a6ab816 (diff)
downloadpdf-as-4-2436aa273f00dafb465c2342ea8e7297898915d2.tar.gz
pdf-as-4-2436aa273f00dafb465c2342ea8e7297898915d2.tar.bz2
pdf-as-4-2436aa273f00dafb465c2342ea8e7297898915d2.zip
Implementations for pdf-as-web and pdf-as-legacy
Diffstat (limited to 'pdf-as-legacy/src/test/java/ByteArrayDataSink.java')
-rw-r--r--pdf-as-legacy/src/test/java/ByteArrayDataSink.java36
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();
+ }
+
+}