org.springframework.core.ConfigurableObjectInputStream Java Examples

The following examples show how to use org.springframework.core.ConfigurableObjectInputStream. 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 File: DefaultDeserializer.java    From spring-analysis-note with 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 File: SerializeUtils.java    From java-master with 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 File: DefaultDeserializer.java    From java-technology-stack with 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 File: BeanUtils.java    From radar with 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 File: DefaultDeserializer.java    From lams with 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 File: DefaultDeserializer.java    From spring4-understanding with 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 File: SpringJavaValueDecoder.java    From jetcache with 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());
}