Java Code Examples for org.springframework.core.ConfigurableObjectInputStream

The following examples show how to use org.springframework.core.ConfigurableObjectInputStream. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: spring-analysis-note   Source File: DefaultDeserializer.java    License: MIT License 5 votes vote down vote up
/**
 * Read from the supplied {@code InputStream} and deserialize the contents
 * into an object.
 * @see ObjectInputStream#readObject()
 */
@Override
@SuppressWarnings("resource")
public Object deserialize(InputStream inputStream) throws IOException {
	ObjectInputStream objectInputStream = new ConfigurableObjectInputStream(inputStream, this.classLoader);
	try {
		return objectInputStream.readObject();
	}
	catch (ClassNotFoundException ex) {
		throw new NestedIOException("Failed to deserialize object type", ex);
	}
}
 
Example 2
Source Project: java-master   Source File: SerializeUtils.java    License: Apache License 2.0 5 votes vote down vote up
public static Object deserialize(@Nullable byte[] bytes) {
    if (bytes == null) {
        return null;
    }
    try {
        ByteArrayInputStream stream = new ByteArrayInputStream(bytes);
        ConfigurableObjectInputStream inputStream =
                new ConfigurableObjectInputStream(stream, Thread.currentThread().getContextClassLoader());
        return inputStream.readObject();
    } catch (Exception e) {
        throw new RuntimeException("deserialize failed", e);
    }
}
 
Example 3
Source Project: java-technology-stack   Source File: DefaultDeserializer.java    License: MIT License 5 votes vote down vote up
/**
 * Read from the supplied {@code InputStream} and deserialize the contents
 * into an object.
 * @see ObjectInputStream#readObject()
 */
@Override
@SuppressWarnings("resource")
public Object deserialize(InputStream inputStream) throws IOException {
	ObjectInputStream objectInputStream = new ConfigurableObjectInputStream(inputStream, this.classLoader);
	try {
		return objectInputStream.readObject();
	}
	catch (ClassNotFoundException ex) {
		throw new NestedIOException("Failed to deserialize object type", ex);
	}
}
 
Example 4
Source Project: radar   Source File: BeanUtils.java    License: Apache License 2.0 5 votes vote down vote up
private static Object deserialize(InputStream inputStream) throws IOException {
	ObjectInputStream objectInputStream = new ConfigurableObjectInputStream(inputStream, BeanUtils.class.getClassLoader());
	try {
		return objectInputStream.readObject();
	}
	catch (ClassNotFoundException ex) {
		logger.error("Failed to deserialize object type", ex);
		throw new NestedIOException("Failed to deserialize object type", ex);
	}
}
 
Example 5
Source Project: lams   Source File: DefaultDeserializer.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Read from the supplied {@code InputStream} and deserialize the contents
 * into an object.
 * @see ObjectInputStream#readObject()
 */
@Override
@SuppressWarnings("resource")
public Object deserialize(InputStream inputStream) throws IOException {
	ObjectInputStream objectInputStream = new ConfigurableObjectInputStream(inputStream, this.classLoader);
	try {
		return objectInputStream.readObject();
	}
	catch (ClassNotFoundException ex) {
		throw new NestedIOException("Failed to deserialize object type", ex);
	}
}
 
Example 6
Source Project: spring4-understanding   Source File: DefaultDeserializer.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Read from the supplied {@code InputStream} and deserialize the contents
 * into an object.
 * @see ObjectInputStream#readObject()
 */
@Override
@SuppressWarnings("resource")
public Object deserialize(InputStream inputStream) throws IOException {
	ObjectInputStream objectInputStream = new ConfigurableObjectInputStream(inputStream, this.classLoader);
	try {
		return objectInputStream.readObject();
	}
	catch (ClassNotFoundException ex) {
		throw new NestedIOException("Failed to deserialize object type", ex);
	}
}
 
Example 7
Source Project: jetcache   Source File: SpringJavaValueDecoder.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected ObjectInputStream buildObjectInputStream(ByteArrayInputStream in) throws IOException {
    return new ConfigurableObjectInputStream(in, Thread.currentThread().getContextClassLoader());
}