Package org.apache.commons.io.input

Examples of org.apache.commons.io.input.ClassLoaderObjectInputStream


        }
        ObjectInputStream in = null;
        try
        {
            // stream closed in the finally
            in = new ClassLoaderObjectInputStream(cl, inputStream);
            Object obj = in.readObject();
            if (obj instanceof DeserializationPostInitialisable)
            {
                DeserializationPostInitialisable.Implementation.init(obj, muleContext);
            }
View Full Code Here


        {
            return null;
        }
        else
        {
            ClassLoaderObjectInputStream classLoaderIS = new ClassLoaderObjectInputStream(this.getClassLoader(),
                is);
            try
            {
                return classLoaderIS.readObject();
            }
            catch (ClassNotFoundException e)
            {
                logger.warn(e.getMessage());
                IOException iox = new IOException();
                iox.initCause(e);
                throw iox;
            }
            finally
            {
                classLoaderIS.close();
            }
        }
    }
View Full Code Here

        if (str == null || str.length() == 0)
            return null;
        ObjectInputStream objStream = null;
        try {
            ByteArrayInputStream serialObj = new ByteArrayInputStream(decodeBytes(str));
            objStream = new ClassLoaderObjectInputStream(Thread.currentThread().getContextClassLoader(), new InflaterInputStream(serialObj));
            return objStream.readObject();
        } catch (Exception e) {
            throw new IOException("Deserialization error: " + e.getMessage(), e);
        } finally {
            IOUtils.closeQuietly(objStream);
View Full Code Here

        }
        ObjectInputStream in = null;
        try
        {
            // stream closed in the finally
            in = new ClassLoaderObjectInputStream(cl, inputStream);
            Object obj = in.readObject();
            if (obj instanceof DeserializationPostInitialisable)
            {
                DeserializationPostInitialisable.Implementation.init(obj, muleContext);
            }
View Full Code Here

        {
            return null;
        }
        else
        {
            ClassLoaderObjectInputStream classLoaderIS = new ClassLoaderObjectInputStream(this.getClassLoader(),
                is);
            try
            {
                return classLoaderIS.readObject();
            }
            catch (ClassNotFoundException e)
            {
                logger.warn(e.getMessage());
                IOException iox = new IOException();
                iox.initCause(e);
                throw iox;
            }
            finally
            {
                classLoaderIS.close();
            }
        }
    }
View Full Code Here

  {
    // read the input stream into an object. we use the the (apache commons-io) ClassLoaderObjectInputStream
    // to read the object because we need to be able to use the same class loader that loaded the class in
    // the first place (for example, the RestfulClassLoader).
    T object;
    try( final ClassLoaderObjectInputStream in = new ClassLoaderObjectInputStream( clazz.getClassLoader(), input ) )
    {
      object = clazz.cast( in.readObject() );
    }
    catch( IOException | ClassNotFoundException e )
    {
      final StringBuilder message = new StringBuilder();
      message.append( "Unable to serialize object to output stream:" ).append( Constants.NEW_LINE );
View Full Code Here

  {
    // read the input stream into an object. we use the the (apache commons-io) ClassLoaderObjectInputStream
    // to read the object because we need to be able to use the same class loader that loaded the class in
    // the first place (for example, the RestfulClassLoader).
    T object;
    try( final ClassLoaderObjectInputStream in = new ClassLoaderObjectInputStream( clazz.getClassLoader(), input ) )
    {
      object = clazz.cast( in.readObject() );
    }
    catch( IOException | ClassNotFoundException e )
    {
      final StringBuilder message = new StringBuilder();
      message.append( "Unable to serialize object to output stream:" ).append( Constants.NEW_LINE );
View Full Code Here

    int len = input.readInt();
    byte[] ser = new byte[len];
    input.readBytes(ser);
    ByteArrayInputStream bis = new ByteArrayInputStream(ser);
    try {
      ClassLoaderObjectInputStream ois = new ClassLoaderObjectInputStream(
          kryo.getClassLoader(), bis);
      return ois.readObject();
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

  public static Object deserialize(byte[] serialized, URLClassLoader loader) {
    try {
      ByteArrayInputStream bis = new ByteArrayInputStream(serialized);
      Object ret = null;
      if (loader != null) {
        ClassLoaderObjectInputStream cis = new ClassLoaderObjectInputStream(
            loader, bis);
        ret = cis.readObject();
        cis.close();
      } else {
        ObjectInputStream ois = new ObjectInputStream(bis);
        ret = ois.readObject();
        ois.close();
      }
View Full Code Here

TOP

Related Classes of org.apache.commons.io.input.ClassLoaderObjectInputStream

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.