This commit is contained in:
Zack Buhman 2025-01-19 02:12:29 -06:00
parent 4b71a0ebb9
commit 3088db1a67
3 changed files with 92 additions and 0 deletions

View File

@ -0,0 +1,7 @@
package java.io;
public interface Closeable
extends AutoCloseable {
void close() throws IOException;
}

View 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;
}
}

View File

@ -0,0 +1,12 @@
package java.nio.file;
public final class Files {
public static InputStream newInputStream(Path path,
OpenOption... options)
throws IOException {
}
}