1 23 24 29 30 package com.sun.ejb.base.io; 31 32 import java.io.InputStream ; 33 import java.io.OutputStream ; 34 import java.io.ObjectInputStream ; 35 import java.io.ObjectOutputStream ; 36 import java.io.IOException ; 37 import com.sun.ejb.spi.io.NonSerializableObjectHandler; 38 import org.apache.catalina.session.IOUtilsCaller; 39 import org.apache.catalina.util.CustomObjectInputStream; 40 41 47 public class IOUtilsCallerImpl implements IOUtilsCaller{ 48 49 50 public IOUtilsCallerImpl() { 51 } 52 53 public ObjectInputStream createObjectInputStream( 54 final InputStream is, 55 final boolean resolveObject, 56 final ClassLoader loader) 57 throws Exception { 58 ObjectInputStream strm = null; 59 try { 60 strm = IOUtils.createObjectInputStream(is, resolveObject, loader); 61 } catch (Exception ex) {} 62 if (strm == null) { 63 strm = new CustomObjectInputStream(is, loader); 64 } 65 return strm; 66 } 67 68 public ObjectOutputStream createObjectOutputStream( 69 final OutputStream os, 70 final boolean replaceObject) throws IOException { 71 return IOUtils.createObjectOutputStream(os, replaceObject, 72 new NonSerializableObjectHandler() { 73 public Object handleNonSerializableObject(Object obj) { 74 return obj; 75 } 76 } 77 ); 78 } 79 80 public ObjectOutputStream createObjectOutputStream( 81 final OutputStream os, 82 final boolean replaceObject, 83 final NonSerializableObjectHandler handler) throws IOException { 84 return IOUtils.createObjectOutputStream(os, replaceObject, handler); 85 } 86 87 } 88 | Popular Tags |