从频道创建流
import java.io.File; import java.io.IOException; /** from NowJava.com - 时 代 Java**/ import java.io.InputStream; import java.io.OutputStream; import java.io.RandomAccessFile; import java.nio.channels.Channels; import java.nio.channels.FileChannel; public class Main { public static void main(String[] argv) { try { // Create a read/writable file channel File file = new File("filename"); FileChannel channel = new RandomAccessFile(file, "rw").getChannel(); OutputStream os = Channels.newOutputStream(channel); InputStream is = Channels.newInputStream(channel);