Home / Class/ InputStreamSourceToByteArrayConverter Class — spring-boot Architecture

InputStreamSourceToByteArrayConverter Class — spring-boot Architecture

Architecture documentation for the InputStreamSourceToByteArrayConverter class in InputStreamSourceToByteArrayConverter.java from the spring-boot codebase.

Entity Profile

Relationship Graph

Source Code

core/spring-boot/src/main/java/org/springframework/boot/convert/InputStreamSourceToByteArrayConverter.java lines 32–55

class InputStreamSourceToByteArrayConverter implements Converter<InputStreamSource, byte[]> {

	@Override
	public byte[] convert(InputStreamSource source) {
		try {
			return FileCopyUtils.copyToByteArray(source.getInputStream());
		}
		catch (IOException ex) {
			throw new IllegalStateException("Unable to read from " + getName(source), ex);
		}
	}

	private String getName(InputStreamSource source) {
		Origin origin = Origin.from(source);
		if (origin != null) {
			return origin.toString();
		}
		if (source instanceof Resource resource) {
			return resource.getDescription();
		}
		return "input stream source";
	}

}

Domain

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free