Problem with imageio: ImageReader stalls on JPEGs at ~95%

From: Aaron Davies (aaron.davies_at_gmail.com)
Date: 06/25/04

  • Next message: ak: "Re: Problem with imageio: ImageReader stalls on JPEGs at ~95%"
    Date: 25 Jun 2004 11:01:22 -0700
    
    

    I'm trying to write some classes for my collaborative whiteboard to
    transmit images over the network, using the javax.imageio API, but I'm
    running into an odd problem: my code words fine with PNGs, but not
    with JPEGs. As you can see below, I've attached a progress listener to
    the reader, which reports progress up to just under 95%, then nothing.
    The warning listener reports no warnings. The images are written by an
    ImageWriter in another section of the code, which also uses the same
    listeners, and *does* report completion w/o warnings. With PNGs, the
    read completes just fine. Any help would be much appreciated; snippets
    follow. (ImageStatusUpdater is a class of mine which implements
    IIOReadProgressListener, IIOWriteProgressListener,
    IIOReadWarningListener, and IIOWriteWarningListener.)

    >From the writer's code:

    Socket _soc = serverSocket.accept();
    ImageWriter _writer = (ImageWriter)
    ImageIO.getImageWritersByFormatName(
        format).next();
    ImageStatusUpdater _isu = new ImageStatusUpdater();
    _writer.addIIOWriteProgressListener(_isu);
    _writer.addIIOWriteWarningListener(_isu);
    _writer.setOutput(ImageIO.createImageOutputStream(_soc
        .getOutputStream()));
    _writer.write(image);

    And the reader's:

    Socket _socket = new Socket(ip, port);
    ImageReader _ir = (ImageReader) ImageIO.
        getImageReadersBySuffix(suffix).next();
    ImageStatusUpdater _isu = new ImageStatusUpdater();
    _ir.addIIOReadProgressListener(_isu);
    _ir.addIIOReadWarningListener(_isu);
    InputStream _is = _socket.getInputStream();
    ImageInputStream _iis = ImageIO.createImageInputStream(_is);
    _ir.setInput(_iis, true, true);
    imageIcon.setImage(_ir.read(0));


  • Next message: ak: "Re: Problem with imageio: ImageReader stalls on JPEGs at ~95%"

    Relevant Pages

    • Problem with imageio: ImageReader stalls on JPEGs at ~95%
      ... transmit images over the network, using the javax.imageio API, but I'm ... ImageWriter in another section of the code, ... ImageStatusUpdater _isu = new ImageStatusUpdater; ... Socket _socket = new Socket ...
      (comp.lang.java)
    • Problem with imageio: ImageReader stalls on JPEGs at ~95%
      ... transmit images over the network, using the javax.imageio API, but I'm ... ImageWriter in another section of the code, ... ImageStatusUpdater _isu = new ImageStatusUpdater; ... Socket _socket = new Socket ...
      (comp.lang.java.programmer)
    • Problem with imageio: ImageReader stalls on JPEGs at ~95%
      ... transmit images over the network, using the javax.imageio API, but I'm ... ImageWriter in another section of the code, ... ImageStatusUpdater _isu = new ImageStatusUpdater; ... Socket _socket = new Socket ...
      (comp.lang.java.help)