37 |
|
|
38 |
package java.nio.channels; |
package java.nio.channels; |
39 |
|
|
40 |
import java.io.*; |
import java.io.InputStream; |
41 |
import java.nio.*; |
import java.io.OutputStream; |
42 |
import java.nio.charset.*; |
import java.io.Reader; |
43 |
|
import java.io.Writer; |
44 |
|
import java.nio.channels.WritableByteChannel; |
45 |
|
import java.nio.charset.Charset; |
46 |
|
import java.nio.charset.CharsetDecoder; |
47 |
|
import java.nio.charset.CharsetEncoder; |
48 |
|
|
49 |
|
/** |
50 |
|
* @since 1.4 |
51 |
|
*/ |
52 |
public final class Channels |
public final class Channels |
53 |
{ |
{ |
54 |
public static InputStream newInputStream(ReadableByteChannel ch) |
/** |
55 |
{ |
* Constructs a stream that reads bytes from the given channel. |
56 |
return null; |
*/ |
57 |
} |
public static InputStream newInputStream (ReadableByteChannel ch) |
58 |
public static OutputStream newOutputStream(final WritableByteChannel ch) |
{ |
59 |
{ |
return null; |
60 |
return null; |
} |
61 |
} |
|
62 |
public static ReadableByteChannel newChannel(final InputStream in) |
/** |
63 |
{ |
* Constructs a stream that writes bytes to the given channel. |
64 |
return null; |
*/ |
65 |
} |
public static OutputStream newOutputStream (WritableByteChannel ch) |
66 |
public static WritableByteChannel newChannel(final OutputStream out) |
{ |
67 |
{ |
return null; |
68 |
|
} |
69 |
return null; |
|
70 |
} |
/** |
71 |
public static Reader newReader(ReadableByteChannel ch, |
* Constructs a channel that reads bytes from the given stream. |
72 |
CharsetDecoder dec, |
*/ |
73 |
int minBufferCap) |
public static ReadableByteChannel newChannel (InputStream in) |
74 |
{ |
{ |
75 |
return null; |
return null; |
76 |
} |
} |
77 |
public static Reader newReader(ReadableByteChannel ch, |
|
78 |
String csName) |
/** |
79 |
{ |
* Constructs a channel that writes bytes to the given stream. |
80 |
return newReader(ch, null, 0); |
*/ |
81 |
} |
public static WritableByteChannel newChannel (OutputStream out) |
82 |
public static Writer newWriter(final WritableByteChannel ch, |
{ |
83 |
final CharsetEncoder enc, |
return null; |
84 |
final int minBufferCap) |
} |
85 |
{ |
|
86 |
return null; |
/** |
87 |
} |
* Constructs a reader that decodes bytes from the given channel using the |
88 |
public static Writer newWriter(WritableByteChannel ch, |
* given decoder. |
89 |
String csName) |
*/ |
90 |
{ |
public static Reader newReader (ReadableByteChannel ch, CharsetDecoder dec, |
91 |
return newWriter(ch, null, 0); |
int minBufferCap) |
92 |
} |
{ |
93 |
|
return null; |
94 |
|
} |
95 |
|
|
96 |
|
/** |
97 |
|
* Constructs a reader that decodes bytes from the given channel according to |
98 |
|
* the named charset. |
99 |
|
* |
100 |
|
* @exception UnsupportedCharsetException If no support for the named charset |
101 |
|
* is available in this instance of the Java virtual machine. |
102 |
|
*/ |
103 |
|
public static Reader newReader (ReadableByteChannel ch, String csName) |
104 |
|
{ |
105 |
|
return newReader (ch, Charset.forName (csName).newDecoder (), -1); |
106 |
|
} |
107 |
|
|
108 |
|
/** |
109 |
|
* Constructs a writer that encodes characters using the given encoder and |
110 |
|
* writes the resulting bytes to the given channel. |
111 |
|
*/ |
112 |
|
public static Writer newWriter (WritableByteChannel ch, CharsetEncoder enc, |
113 |
|
int minBufferCap) |
114 |
|
{ |
115 |
|
return null; |
116 |
|
} |
117 |
|
|
118 |
|
/** |
119 |
|
* Constructs a writer that encodes characters according to the named charset |
120 |
|
* and writes the resulting bytes to the given channel. |
121 |
|
* |
122 |
|
* @exception UnsupportedCharsetException If no support for the named charset |
123 |
|
* is available in this instance of the Java virtual machine. |
124 |
|
*/ |
125 |
|
public static Writer newWriter (WritableByteChannel ch, |
126 |
|
String csName) |
127 |
|
{ |
128 |
|
return newWriter (ch, Charset.forName (csName).newEncoder (), -1); |
129 |
|
} |
130 |
} |
} |