NamedPipeInputStream.java
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13: package xeij;
14:
15: import java.io.*;
16:
17: public abstract class NamedPipeInputStream extends InputStream {
18:
19: public static NamedPipeInputStream createInputStream (String name) throws IOException {
20: if (XEiJ.prgWindllLoaded) {
21: return new NamedPipeInputStream.Win (name);
22: }
23: throw new IOException ("Unsupported operating system");
24: }
25:
26: public abstract void cancel () throws IOException;
27: public abstract void connect () throws IOException;
28:
29: protected static class Win extends NamedPipeInputStream {
30: private long wp;
31: public Win (String name) throws IOException {
32: open (name);
33: }
34: @Override public native int available () throws IOException;
35: @Override public native void cancel () throws IOException;
36: @Override public native void close () throws IOException;
37: @Override public native void connect () throws IOException;
38: public native void open (String name) throws IOException;
39: @Override public native int read () throws IOException;
40: @Override public native int read (byte[] b) throws IOException;
41: @Override public native int read (byte[] b, int off, int len) throws IOException;
42: @Override public native int readNBytes (byte[] b, int off, int len) throws IOException;
43: }
44:
45: }