当前位置: 首页>>代码示例>>Java>>正文


Java ChannelInputStream类代码示例

本文整理汇总了Java中sun.nio.ch.ChannelInputStream的典型用法代码示例。如果您正苦于以下问题:Java ChannelInputStream类的具体用法?Java ChannelInputStream怎么用?Java ChannelInputStream使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ChannelInputStream类属于sun.nio.ch包,在下文中一共展示了ChannelInputStream类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initializeReader

import sun.nio.ch.ChannelInputStream; //导入依赖的package包/类
private void initializeReader() throws FileNotFoundException {
	if (inputFile == null) {
		throw new IllegalStateException("Can't initialize reader while input file is null");
	}

	buf = new BufferedReader(new InputStreamReader(new ChannelInputStream((new RandomAccessFile(inputFile, "r")).getChannel())));
	lineNumber = 0;
	linesRead = 0;
}
 
开发者ID:chipster,项目名称:chipster,代码行数:10,代码来源:ConversionModel.java

示例2: newInputStream

import sun.nio.ch.ChannelInputStream; //导入依赖的package包/类
/**
 * Constructs a stream that reads bytes from the given channel.
 *
 * <p> The <tt>read</tt> methods of the resulting stream will throw an
 * {@link IllegalBlockingModeException} if invoked while the underlying
 * channel is in non-blocking mode.  The stream will not be buffered, and
 * it will not support the {@link InputStream#mark mark} or {@link
 * InputStream#reset reset} methods.  The stream will be safe for access by
 * multiple concurrent threads.  Closing the stream will in turn cause the
 * channel to be closed.  </p>
 *
 * @param  ch
 *         The channel from which bytes will be read
 *
 * @return  A new input stream
 */
public static InputStream newInputStream(ReadableByteChannel ch) {
    checkNotNull(ch, "ch");
    return new sun.nio.ch.ChannelInputStream(ch);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:Channels.java

示例3: newInputStream

import sun.nio.ch.ChannelInputStream; //导入依赖的package包/类
/**
 * Constructs a stream that reads bytes from the given channel.
 *
 * <p> The {@code read} methods of the resulting stream will throw an
 * {@link IllegalBlockingModeException} if invoked while the underlying
 * channel is in non-blocking mode.  The stream will not be buffered, and
 * it will not support the {@link InputStream#mark mark} or {@link
 * InputStream#reset reset} methods.  The stream will be safe for access by
 * multiple concurrent threads.  Closing the stream will in turn cause the
 * channel to be closed.  </p>
 *
 * @param  ch
 *         The channel from which bytes will be read
 *
 * @return  A new input stream
 */
public static InputStream newInputStream(ReadableByteChannel ch) {
    Objects.requireNonNull(ch, "ch");
    return new ChannelInputStream(ch);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:Channels.java

示例4: newInputStream

import sun.nio.ch.ChannelInputStream; //导入依赖的package包/类
/**
    * Constructs a stream that reads bytes from the given channel.
    *
    * <p> The <tt>read</tt> methods of the resulting stream will throw an
    * {@link IllegalBlockingModeException} if invoked while the underlying
    * channel is in non-blocking mode.  The stream will not be buffered, and
    * it will not support the {@link InputStream#mark mark} or {@link
    * InputStream#reset reset} methods.  The stream will be safe for access by
    * multiple concurrent threads.  Closing the stream will in turn cause the
    * channel to be closed.  </p>
    *
    * @param  ch
    *         The channel from which bytes will be read
    *
    * @return  A new input stream
    */
   public static InputStream newInputStream(ReadableByteChannel ch) {
return new sun.nio.ch.ChannelInputStream(ch);
   }
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:20,代码来源:Channels.java


注:本文中的sun.nio.ch.ChannelInputStream类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。