diff options
Diffstat (limited to 'pdf-as-legacy/src/test/java/ByteArrayDataSource.java')
-rw-r--r-- | pdf-as-legacy/src/test/java/ByteArrayDataSource.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/pdf-as-legacy/src/test/java/ByteArrayDataSource.java b/pdf-as-legacy/src/test/java/ByteArrayDataSource.java new file mode 100644 index 00000000..d4b83cc4 --- /dev/null +++ b/pdf-as-legacy/src/test/java/ByteArrayDataSource.java @@ -0,0 +1,35 @@ +import java.io.ByteArrayInputStream; +import java.io.InputStream; + +import at.gv.egiz.pdfas.api.io.DataSource; + + +public class ByteArrayDataSource implements DataSource { + + private byte[] data; + + public ByteArrayDataSource(byte[] data) { + this.data = data; + } + + public InputStream createInputStream() { + return new ByteArrayInputStream(data); + } + + public int getLength() { + return data.length; + } + + public byte[] getAsByteArray() { + return data; + } + + public String getMimeType() { + return "application/pdf"; + } + + public String getCharacterEncoding() { + return "UTF-8"; + } + +} |