throws IOException
{
this.parameters = parameters;
this.resources = resources;
DecodeResult decodeResult = null;
List<String> filters = getFilters();
if (filters == null || filters.isEmpty())
{
this.stream = new PDMemoryStream(data);
}
else
{
ByteArrayInputStream in = new ByteArrayInputStream(data);
ByteArrayOutputStream out = new ByteArrayOutputStream(data.length);
for (int i = 0; i < filters.size(); i++)
{
// TODO handling of abbreviated names belongs here, rather than in other classes
out.reset();
Filter filter = FilterFactory.INSTANCE.getFilter(filters.get(i));
decodeResult = filter.decode(in, out, parameters, i);
in = new ByteArrayInputStream(out.toByteArray());
}
byte[] finalData = out.toByteArray();
this.stream = new PDMemoryStream(finalData);
}
// repair parameters
if (decodeResult != null)
{
parameters.addAll(decodeResult.getParameters());
}
}