Java Code Examples for org.apache.flink.shaded.netty4.io.netty.channel.DefaultFileRegion

The following examples show how to use org.apache.flink.shaded.netty4.io.netty.channel.DefaultFileRegion. 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
@Override
public ChannelFuture write(Object msg, ChannelPromise promise) {
	if (msg instanceof DefaultFileRegion) {
		final DefaultFileRegion defaultFileRegion = (DefaultFileRegion) msg;

		try (final FileOutputStream fileOutputStream = new FileOutputStream(outputFile)) {
			fileOutputStream.getChannel();

			defaultFileRegion.transferTo(fileOutputStream.getChannel(), 0L);
		} catch (IOException ioe) {
			throw new RuntimeException(ioe);
		}
	}

	return new DefaultChannelPromise(new EmbeddedChannel());
}
 
Example 2
Source Project: flink   Source File: AbstractTaskManagerFileHandlerTest.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public ChannelFuture write(Object msg, ChannelPromise promise) {
	if (msg instanceof DefaultFileRegion) {
		final DefaultFileRegion defaultFileRegion = (DefaultFileRegion) msg;

		try (final FileOutputStream fileOutputStream = new FileOutputStream(outputFile)) {
			fileOutputStream.getChannel();

			defaultFileRegion.transferTo(fileOutputStream.getChannel(), 0L);
		} catch (IOException ioe) {
			throw new RuntimeException(ioe);
		}
	}

	return new DefaultChannelPromise(new EmbeddedChannel());
}
 
Example 3
Source Project: flink   Source File: AbstractTaskManagerFileHandlerTest.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public ChannelFuture write(Object msg, ChannelPromise promise) {
	if (msg instanceof DefaultFileRegion) {
		final DefaultFileRegion defaultFileRegion = (DefaultFileRegion) msg;

		try (final FileOutputStream fileOutputStream = new FileOutputStream(outputFile)) {
			fileOutputStream.getChannel();

			defaultFileRegion.transferTo(fileOutputStream.getChannel(), 0L);
		} catch (IOException ioe) {
			throw new RuntimeException(ioe);
		}
	}

	return new DefaultChannelPromise(new EmbeddedChannel());
}