} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
RenderedImage ri = null;
SerializableRenderedImage sri;
// Switch according to object class; ignore unsupported types.
if (obj instanceof String) {
String str = (String)obj;
if (str.equals(CLOSE_MESSAGE)) {
// Decrement the remote reference count.
decrementRemoteReferenceCount(this);
} else {
if (str.equals("createDefaultRendering")) {
ri = source.createDefaultRendering();
} else if (str.equals("createRendering")) {
// Read the Object from the object stream.
obj = null;
try {
obj = objectIn.readObject();
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
SerializableState ss = (SerializableState)obj;
RenderContext rc = (RenderContext)ss.getObject();
ri = source.createRendering(rc);
} else if (str.equals("createScaledRendering")) {
// Read the Object from the object stream.
obj = null;
try {
obj = objectIn.readObject();
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
int w = ((Integer)obj).intValue();
try {
obj = objectIn.readObject();
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
int h = ((Integer)obj).intValue();
try {
obj = objectIn.readObject();
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
SerializableState ss = (SerializableState)obj;
RenderingHints rh = (RenderingHints)ss.getObject();
ri = source.createScaledRendering(w, h, rh);
}
if (useTileCodec) {
try {
sri = new SerializableRenderedImage(ri,
true,
registry,
formatName,
encodingParam,
decodingParam);
} catch (java.io.NotSerializableException nse) {
throw new RuntimeException(nse.getMessage());
}
} else {
sri = new SerializableRenderedImage(ri, true);
}
try {
objectOut.writeObject(sri);
} catch (Exception e) {