sun.nio.ch.ChannelInputStream Java Examples

The following examples show how to use sun.nio.ch.ChannelInputStream. 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: ConversionModel.java    From chipster with MIT License 5 votes vote down vote up
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;
}
 
Example #2
Source File: Channels.java    From Java8CN with Apache License 2.0 2 votes vote down vote up
/**
 * 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);
}
 
Example #3
Source File: Channels.java    From j2objc with Apache License 2.0 2 votes vote down vote up
/**
 * 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);
}
 
Example #4
Source File: Channels.java    From jdk8u-dev-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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);
}
 
Example #5
Source File: Channels.java    From jdk-1.7-annotated with Apache License 2.0 2 votes vote down vote up
/**
 * 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);
}
 
Example #6
Source File: Channels.java    From jdk8u-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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);
}
 
Example #7
Source File: Channels.java    From jdk8u_jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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);
}
 
Example #8
Source File: Channels.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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);
}
 
Example #9
Source File: Channels.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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);
}
 
Example #10
Source File: Channels.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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);
}
 
Example #11
Source File: Channels.java    From jdk1.8-source-analysis with Apache License 2.0 2 votes vote down vote up
/**
 * 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);
}
 
Example #12
Source File: Channels.java    From jdk8u-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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);
}
 
Example #13
Source File: Channels.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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);
}
 
Example #14
Source File: Channels.java    From Bytecoder with Apache License 2.0 2 votes vote down vote up
/**
 * 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);
}
 
Example #15
Source File: Channels.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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);
}
 
Example #16
Source File: Channels.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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);
}
 
Example #17
Source File: Channels.java    From JDKSourceCode1.8 with MIT License 2 votes vote down vote up
/**
 * 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);
}
 
Example #18
Source File: Channels.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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);
}
 
Example #19
Source File: Channels.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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);
}
 
Example #20
Source File: Channels.java    From dragonwell8_jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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);
}