Package javax.media.jai.util

Examples of javax.media.jai.util.ImagingException


   if (serverName == null) {
      try {
    serverName = InetAddress.getLocalHost().getHostAddress();
      } catch(Exception e) {
                sendExceptionToListener(JaiI18N.getString("JAIRMIDescriptor13"),
                                        new ImagingException(JaiI18N.getString("JAIRMIDescriptor13"), e));
//    throw new RuntimeException(e.getMessage());
      }
  }

  // Derive the service name.
View Full Code Here


                objectOut = new ObjectOutputStream(out);
                in = socket.getInputStream();
                objectIn = new ObjectInputStream(in);
            } catch (IOException e) {
                sendExceptionToListener(JaiI18N.getString("SerializableRenderedImage7"),
                                        new ImagingException(JaiI18N.getString("SerializableRenderedImage7"), e));
//                throw new RuntimeException(e.getMessage());
            }

            // Write the Rectangle to the object output stream.
            try {
                objectOut.writeObject(rect);
            } catch (IOException e) {
                sendExceptionToListener(JaiI18N.getString("SerializableRenderedImage10"),
                                        new ImagingException(JaiI18N.getString("SerializableRenderedImage10"), e));
//                throw new RuntimeException(e.getMessage());
            }

            // Read serialized form of the Raster from object output stream.
            Object object = null;
            try {
                object = objectIn.readObject();
            } catch (IOException e) {
                sendExceptionToListener(JaiI18N.getString("SerializableRenderedImage8"),
                                        new ImagingException(JaiI18N.getString("SerializableRenderedImage8"), e));
//                throw new RuntimeException(e.getMessage());
            } catch (ClassNotFoundException e) {
                sendExceptionToListener(JaiI18N.getString("SerializableRenderedImage9"),
                                        new ImagingException(JaiI18N.getString("SerializableRenderedImage9"), e));
      }

            if (useTileCodec) {
                byte[] buf = (byte[])object;
                raster = decodeRasterFromByteArray(buf);
            }
            else {
                if (!(object instanceof SerializableState))
                    raster = null;
                // Reconstruct the Raster from the serialized form.
                SerializableState ss = (SerializableState)object;
                Class c = ss.getObjectClass();
                if (Raster.class.isAssignableFrom(c)) {
                    raster = (Raster)ss.getObject();
                }
                else raster = null;
            }

      // Close the various streams and the socket.
            try {
    objectOut.flush();
    socket.shutdownOutput();
    socket.shutdownInput();
                objectOut.close();
                out.close();
                objectIn.close();
                in.close();
                socket.close();
            } catch (IOException e) {
                String message =
                    JaiI18N.getString("SerializableRenderedImage11");
                sendExceptionToListener(message,
                                        new ImagingException(message, e));
//                throw new RuntimeException(e.getMessage());
            }

            // If the rectangle equals the image bounds, cache the Raster,
            // switch to "deep copy" mode, and notify the data server.
View Full Code Here

            out = socket.getOutputStream();
            objectOut = new ObjectOutputStream(out);
      objectIn = new ObjectInputStream(socket.getInputStream());
        } catch (IOException e) {
            sendExceptionToListener(JaiI18N.getString("SerializableRenderedImage7"),
                                    new ImagingException(JaiI18N.getString("SerializableRenderedImage7"), e));
//            throw new RuntimeException(e.getMessage());
        }

        // Write CLOSE_MESSAGE to the object output stream.
        try {
            objectOut.writeObject(CLOSE_MESSAGE);
        } catch (IOException e) {
            sendExceptionToListener(JaiI18N.getString("SerializableRenderedImage13"),
                                    new ImagingException(JaiI18N.getString("SerializableRenderedImage13"), e));
//            throw new RuntimeException(e.getMessage());
        }

  try {
      objectIn.readObject();
  } catch (IOException e) {
            sendExceptionToListener(JaiI18N.getString(
              "SerializableRenderedImage8"),
                                    new ImagingException(JaiI18N.getString(
              "SerializableRenderedImage8"), e));
  } catch (ClassNotFoundException cnfe) {
            sendExceptionToListener(JaiI18N.getString(
           "SerializableRenderedImage9"),
                                    new ImagingException(JaiI18N.getString(
           "SerializableRenderedImage9"), cnfe));
  }

        // Close the streams and the socket.
        try {
      objectOut.flush();
      socket.shutdownOutput();
            objectOut.close();
            out.close();
      objectIn.close();
            socket.close();
        } catch (IOException e) {
            sendExceptionToListener(JaiI18N.getString("SerializableRenderedImage11"),
                                    new ImagingException(JaiI18N.getString(
              "SerializableRenderedImage11"), e));
//            throw new RuntimeException(e.getMessage());
        }
    }
View Full Code Here

        try {
            socket = new Socket(host, port);
      socket.setSoLinger(true,1);
        } catch (IOException e) {
            sendExceptionToListener(JaiI18N.getString("SerializableRenderedImage14"),
                                    new ImagingException(JaiI18N.getString("SerializableRenderedImage14"), e));
//            throw new RuntimeException(e.getMessage());
        }

        return socket;
    }
View Full Code Here

        try {
            encoder.encode(raster);
            return bos.toByteArray();
        } catch (IOException e) {
            sendExceptionToListener(JaiI18N.getString("SerializableRenderedImage15"),
                                    new ImagingException(JaiI18N.getString("SerializableRenderedImage15"), e));
//            throw new RuntimeException(e.getMessage());
        }
        return null;
    }
View Full Code Here

            tileDecoderFactory.createDecoder(bis, decodingParam);
        try {
            return decoder.decode();
        } catch (IOException e) {
            sendExceptionToListener(JaiI18N.getString("SerializableRenderedImage16"),
                                    new ImagingException(JaiI18N.getString("SerializableRenderedImage16"), e));
//            throw new RuntimeException(e.getMessage());
        }
        return null;
    }
View Full Code Here

                    // accept() timeout: restart loop to check
                    // availability flag.
                    continue;
                } catch (SocketException e) {
                    sendExceptionToListener(JaiI18N.getString("SerializableRenderedImage5"),
                                            new ImagingException(JaiI18N.getString("SerializableRenderedImage5"), e));
//                    throw new RuntimeException(e.getMessage());
                } catch (IOException e) {
                    sendExceptionToListener(JaiI18N.getString("SerializableRenderedImage6"),
                                            new ImagingException(JaiI18N.getString("SerializableRenderedImage6"), e));
                }

                // Get the socket input and output streams and wrap object
                // input and output streams around them, respectively.
                InputStream in = null;
                OutputStream out = null;
                ObjectInputStream objectIn = null;
                ObjectOutputStream objectOut = null;
                try {
                    in = socket.getInputStream();
                    out = socket.getOutputStream();
                    objectIn = new ObjectInputStream(in);
                    objectOut = new ObjectOutputStream(out);
                } catch (IOException e) {
                    sendExceptionToListener(JaiI18N.getString("SerializableRenderedImage7"),
                                            new ImagingException(JaiI18N.getString("SerializableRenderedImage7"), e));
//                    throw new RuntimeException(e.getMessage());
                }

                // Read the Object from the object stream.
                Object obj = null;
                try {
                    obj = objectIn.readObject();
                } catch (IOException e) {
                    sendExceptionToListener(JaiI18N.getString("SerializableRenderedImage8"),
                                            new ImagingException(JaiI18N.getString("SerializableRenderedImage8"), e));
//                    throw new RuntimeException(e.getMessage());
                } catch (ClassNotFoundException e) {
                    sendExceptionToListener(JaiI18N.getString("SerializableRenderedImage9"),
                                            new ImagingException(JaiI18N.getString("SerializableRenderedImage9"), e));
                }

                // Switch according to object class; ignore unsupported types.
                if (obj instanceof String &&
                    ((String)obj).equals(CLOSE_MESSAGE)) {

        try {
      objectOut.writeObject(CLOSE_ACK);
        } catch (IOException e) {
      sendExceptionToListener(JaiI18N.getString(
              "SerializableRenderedImage17"),
                            new ImagingException(JaiI18N.getString(
              "SerializableRenderedImage17"), e));
      // throw new RuntimeException(e.getMessage());
        }

                    // Decrement the remote reference count.
                    decrementRemoteReferenceCount(this);
                } else if (obj instanceof Rectangle) {

                    // Retrieve the Raster of data from the source image.
                    Raster raster = source.getData((Rectangle)obj);
                    // Write the serializable Raster to the
                    // object output stream.

                    if (useTileCodec) {
                        byte[] buf = encodeRasterToByteArray(raster);
                        try {
                            objectOut.writeObject(buf);
                        } catch (IOException e) {
                            sendExceptionToListener(JaiI18N.getString("SerializableRenderedImage10"),
                                                    new ImagingException(JaiI18N.getString("SerializableRenderedImage10"), e));
//                            throw new RuntimeException(e.getMessage());
                        }
                    }
                    else {
                        try {
                            objectOut.writeObject(SerializerFactory.getState(raster, null));
                        } catch (IOException e) {
                            sendExceptionToListener(JaiI18N.getString("SerializableRenderedImage10"),
                                                    new ImagingException(JaiI18N.getString("SerializableRenderedImage10"), e));
//                            throw new RuntimeException(e.getMessage());
                        }
                    }
                }

                // XXX Concerning serialization of properties, perhaps the
                // best approach would be to serialize all the properties up
                // front if a deep copy were being made but otherwise to wait
                // until the first property request was received before
                // transmitting any property values. When the first request
                // was made, all property values would be transmitted and then
                // cached. Up front serialization might in both cases include
                // transmitting all names. If property serialization were
                // deferred, then a new message branch would be added here
                // to retrieve the properties which could be obtained as
                // a PropertySourceImpl. If properties are also served up
                // then this inner class should be renamed "DataServer".

                // Close the various streams and the socket itself.
                try {
        objectOut.flush();
        socket.shutdownOutput();
        socket.shutdownInput();
                    objectOut.close();
                    objectIn.close();
                    out.close();
                    in.close();
                    socket.close();
                } catch (IOException e) {
                    sendExceptionToListener(JaiI18N.getString("SerializableRenderedImage10"),
                                            new ImagingException(JaiI18N.getString("SerializableRenderedImage10"), e));
//                    throw new RuntimeException(e.getMessage());
                }
            }
        }
View Full Code Here

        // Sleep for retryInterval milliseconds
        try {
      Thread.sleep(retryInterval);
        } catch (InterruptedException ie) {
                        sendExceptionToListener(JaiI18N.getString("Generic5"),
                                                new ImagingException(JaiI18N.getString("Generic5"), ie));
//      throw new RuntimeException(ie.toString());
        }
    }
      }
View Full Code Here

        try {
      Thread.sleep(retryInterval);
        } catch (InterruptedException ie) {
//      throw new ImagingException(ie);
                        sendExceptionToListener(JaiI18N.getString("Generic5"),
                                                new ImagingException(JaiI18N.getString("Generic5"), ie));
        }
    }
      }

      if (descriptors == null && count > numRetries) {
View Full Code Here

        Method method = null;
        try {
            method = GRAPHICS2D_CLASS.getMethod(name, argTypes);
        } catch(Exception e) {
            String message = JaiI18N.getString("TiledGraphicsGraphics2") + name;
            sendExceptionToListener(message, new ImagingException(e));
//            throw new RuntimeException(e.getMessage());
        }

        // Queue the Method object and the Object[] argument array as an
        // ordered pair (Method, Object[]).
View Full Code Here

TOP

Related Classes of javax.media.jai.util.ImagingException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.