49 |
import java.lang.reflect.Constructor; |
import java.lang.reflect.Constructor; |
50 |
import java.lang.reflect.InvocationTargetException; |
import java.lang.reflect.InvocationTargetException; |
51 |
|
|
52 |
public final class VMChannels |
final class VMChannels |
53 |
{ |
{ |
54 |
/** |
/** |
55 |
* This class isn't intended to be instantiated. |
* This class isn't intended to be instantiated. |
95 |
/** |
/** |
96 |
* Constructs a stream that reads bytes from the given channel. |
* Constructs a stream that reads bytes from the given channel. |
97 |
*/ |
*/ |
98 |
public static InputStream newInputStream(ReadableByteChannel ch) |
static InputStream newInputStream(ReadableByteChannel ch) |
99 |
{ |
{ |
100 |
if (ch instanceof FileChannelImpl) |
if (ch instanceof FileChannelImpl) |
101 |
return (FileInputStream) createStream(FileInputStream.class, ch); |
return (FileInputStream) createStream(FileInputStream.class, ch); |
106 |
/** |
/** |
107 |
* Constructs a stream that writes bytes to the given channel. |
* Constructs a stream that writes bytes to the given channel. |
108 |
*/ |
*/ |
109 |
public static OutputStream newOutputStream(WritableByteChannel ch) |
static OutputStream newOutputStream(WritableByteChannel ch) |
110 |
{ |
{ |
111 |
if (ch instanceof FileChannelImpl) |
if (ch instanceof FileChannelImpl) |
112 |
return (FileOutputStream) createStream(FileOutputStream.class, ch); |
return (FileOutputStream) createStream(FileOutputStream.class, ch); |