コード例 #1
0
  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())));
    }
  }
コード例 #2
0
  protected void resetMembers() {
    if (reader != null) {
      reader.dispose();
    }

    reader = null;
  }
コード例 #3
0
  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;
  }
コード例 #4
0
 public Iterator<ImageTypeSpecifier> getImageTypes(final int pImageIndex) throws IOException {
   init();
   return reader.getImageTypes(pImageIndex);
 }
コード例 #5
0
 public int getHeight(int pIndex) throws IOException {
   init();
   return reader.getHeight(pIndex);
 }
コード例 #6
0
 public int getWidth(int pIndex) throws IOException {
   init();
   return reader.getWidth(pIndex);
 }