Ejemplo n.º 1
0
 private void testSetupFilterList() {
   stream.setupFilterList();
   PDFFilterList filterList = stream.getFilterList();
   assertTrue(filterList.isInitialized());
   assertEquals(1, filterList.getFilters().size());
   PDFFilter filter = filterList.getFilters().get(0);
   assertEquals("/FlateDecode", filter.getName());
 }
Ejemplo n.º 2
0
 @Test
 public void customFilter() {
   PDFFilterList filters = stream.getFilterList();
   filters.addFilter("null");
   assertTrue(filters.isInitialized());
   assertEquals(1, filters.getFilters().size());
   PDFFilter filter = filters.getFilters().get(0);
   assertEquals("", filter.getName());
 }
Ejemplo n.º 3
0
 @Test
 public void testStream() throws IOException {
   PDFFilterList filters = stream.getFilterList();
   filters.addFilter("null");
   byte[] bytes = createSampleData();
   stream.setData(bytes);
   ByteArrayOutputStream actual = new ByteArrayOutputStream();
   stream.outputRawStreamData(actual);
   assertArrayEquals(bytes, actual.toByteArray());
 }
Ejemplo n.º 4
0
 @Test
 public void testEncodeAndWriteStream() throws IOException {
   PDFFilterList filters = stream.getFilterList();
   filters.addFilter("null");
   byte[] bytes = createSampleData();
   stream.setData(bytes);
   ByteArrayOutputStream actual = new ByteArrayOutputStream();
   PDFNumber number = new PDFNumber();
   stream.encodeAndWriteStream(actual, number);
   assertArrayEquals(createSampleStreamData(), actual.toByteArray());
 }
Ejemplo n.º 5
0
 private void testGetFilterList() {
   PDFFilterList filterList = stream.getFilterList();
   assertFalse(filterList.isInitialized());
   assertEquals(0, filterList.getFilters().size());
 }