Java Code Examples for org.springframework.core.io.buffer.DataBufferUtils#takeUntilByteCount()

The following examples show how to use org.springframework.core.io.buffer.DataBufferUtils#takeUntilByteCount() . 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: ResourceRegionEncoder.java    From spring-analysis-note with MIT License 5 votes vote down vote up
private Flux<DataBuffer> writeResourceRegion(
		ResourceRegion region, DataBufferFactory bufferFactory, @Nullable Map<String, Object> hints) {

	Resource resource = region.getResource();
	long position = region.getPosition();
	long count = region.getCount();

	if (logger.isDebugEnabled() && !Hints.isLoggingSuppressed(hints)) {
		logger.debug(Hints.getLogPrefix(hints) +
				"Writing region " + position + "-" + (position + count) + " of [" + resource + "]");
	}

	Flux<DataBuffer> in = DataBufferUtils.read(resource, position, bufferFactory, this.bufferSize);
	return DataBufferUtils.takeUntilByteCount(in, count);
}
 
Example 2
Source File: ResourceRegionEncoder.java    From java-technology-stack with MIT License 5 votes vote down vote up
private Flux<DataBuffer> writeResourceRegion(
		ResourceRegion region, DataBufferFactory bufferFactory, @Nullable Map<String, Object> hints) {

	Resource resource = region.getResource();
	long position = region.getPosition();
	long count = region.getCount();

	if (logger.isDebugEnabled() && !Hints.isLoggingSuppressed(hints)) {
		logger.debug(Hints.getLogPrefix(hints) +
				"Writing region " + position + "-" + (position + count) + " of [" + resource + "]");
	}

	Flux<DataBuffer> in = DataBufferUtils.read(resource, position, bufferFactory, this.bufferSize);
	return DataBufferUtils.takeUntilByteCount(in, count);
}