-
- static native FileInputStream newInputStream(FileChannelImpl ch);
-
- static native FileOutputStream newOutputStream(FileChannelImpl ch);
-
- /**
- * Constructs a channel that reads bytes from the given stream.
- */
- public static ReadableByteChannel newChannel(InputStream in)
- {
- return new InputStreamChannel(in);
- }
-
- /**
- * Constructs a channel that writes bytes to the given stream.
- */
- public static WritableByteChannel newChannel(OutputStream out)
- {
- return new OutputStreamChannel(out);
- }
-
- /**
- * Constructs a reader that decodes bytes from the given channel using the
- * given decoder.
- */
- public static Reader newReader(ReadableByteChannel ch, CharsetDecoder dec,
- int minBufferCap)
- {
- return new ChannelReader(ch, dec, minBufferCap);
- }
-
- /**
- * Constructs a reader that decodes bytes from the given channel according to
- * the named charset.
- *
- * @exception UnsupportedCharsetException If no support for the named charset
- * is available in this instance of the Java virtual machine.
- */
- public static Reader newReader(ReadableByteChannel ch, String csName)
- {
- return newReader(ch, Charset.forName(csName).newDecoder(), -1);
- }
-
- /**
- * Constructs a writer that encodes characters using the given encoder and
- * writes the resulting bytes to the given channel.
- */
- public static Writer newWriter(WritableByteChannel ch, CharsetEncoder enc,
- int minBufferCap)
- {
- // FIXME: implement java.nio.channels.Channel.newWriter(WritableByteChannel, CharsetEncoder, int)
- throw new Error("not implemented");
- }
-
- /**
- * Constructs a writer that encodes characters according to the named charset
- * and writes the resulting bytes to the given channel.
- *
- * @exception UnsupportedCharsetException If no support for the named charset
- * is available in this instance of the Java virtual machine.
- */
- public static Writer newWriter(WritableByteChannel ch, String csName)
- {
- return newWriter(ch, Charset.forName(csName).newEncoder(), -1);
- }