private synchronized void init() throws IOException { // Need the extra test, to avoid throwing an IOException from the Transcoder if (imageInput == null) { throw new IllegalStateException("input == null"); } if (reader == null) { WMFTranscoder transcoder = new WMFTranscoder(); ByteArrayOutputStream output = new ByteArrayOutputStream(); Writer writer = new OutputStreamWriter(output, "UTF8"); try { TranscoderInput in = new TranscoderInput(IIOUtil.createStreamAdapter(imageInput)); TranscoderOutput out = new TranscoderOutput(writer); // TODO: Transcodinghints? transcoder.transcode(in, out); } catch (TranscoderException e) { throw new IIOException(e.getMessage(), e); } reader = new SVGImageReader(getOriginatingProvider()); reader.setInput( ImageIO.createImageInputStream(new ByteArrayInputStream(output.toByteArray()))); } }
protected void resetMembers() { if (reader != null) { reader.dispose(); } reader = null; }
public BufferedImage read(int pIndex, ImageReadParam pParam) throws IOException { init(); processImageStarted(pIndex); BufferedImage image = reader.read(pIndex, pParam); if (abortRequested()) { processReadAborted(); return image; } processImageComplete(); return image; }
public Iterator<ImageTypeSpecifier> getImageTypes(final int pImageIndex) throws IOException { init(); return reader.getImageTypes(pImageIndex); }
public int getHeight(int pIndex) throws IOException { init(); return reader.getHeight(pIndex); }
public int getWidth(int pIndex) throws IOException { init(); return reader.getWidth(pIndex); }