wip
This commit is contained in:
parent
4b71a0ebb9
commit
3088db1a67
7
classes/java/io/Closeable.java
Normal file
7
classes/java/io/Closeable.java
Normal file
@ -0,0 +1,7 @@
|
||||
package java.io;
|
||||
|
||||
public interface Closeable
|
||||
extends AutoCloseable {
|
||||
|
||||
void close() throws IOException;
|
||||
}
|
73
classes/java/io/InputStream.java
Normal file
73
classes/java/io/InputStream.java
Normal file
@ -0,0 +1,73 @@
|
||||
package java.io;
|
||||
|
||||
public abstract class InputStream
|
||||
implements Closeable {
|
||||
|
||||
public InputStream() {
|
||||
}
|
||||
|
||||
|
||||
public int available() throws IOException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
}
|
||||
|
||||
public void mark(int readlimit) {
|
||||
}
|
||||
|
||||
public abstract int read() throws IOException;
|
||||
|
||||
public int read(byte[] b) throws IOException {
|
||||
return read(b, 0, b.length);
|
||||
}
|
||||
|
||||
public int read(byte[] b,
|
||||
int off,
|
||||
int len) throws IOException {
|
||||
if (off < 0 || len < 0 || len > b.length - off)
|
||||
throw new IndexOutOfBoundsException();
|
||||
|
||||
if (b == null)
|
||||
throw new NullPointerException();
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
try {
|
||||
int b = read();
|
||||
bool endOfStream = b == -1;
|
||||
if (endOfStream) {
|
||||
if (i == 0)
|
||||
return -1;
|
||||
else
|
||||
return i;
|
||||
}
|
||||
b[off + i] = (byte)b;
|
||||
} catch (IOException e) {
|
||||
if (i == 0)
|
||||
throw e;
|
||||
else
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
public void reset() throws IOException {
|
||||
throw new IOException();
|
||||
}
|
||||
|
||||
public long skip(long n)
|
||||
throws IOException {
|
||||
|
||||
long ni = n;
|
||||
while (ni > 0L) {
|
||||
int b = read();
|
||||
if (b < 0)
|
||||
break;
|
||||
ni -= 1;
|
||||
}
|
||||
return n - ni;
|
||||
}
|
||||
}
|
12
classes/java/nio/file/Files.java
Normal file
12
classes/java/nio/file/Files.java
Normal file
@ -0,0 +1,12 @@
|
||||
package java.nio.file;
|
||||
|
||||
public final class Files {
|
||||
|
||||
|
||||
public static InputStream newInputStream(Path path,
|
||||
OpenOption... options)
|
||||
throws IOException {
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user