Update #35 - Fixes, improved dynamic lighting

This commit is contained in:
lax1dude
2024-06-16 16:47:12 -07:00
parent ad3579659d
commit 77c6c217f4
42 changed files with 385 additions and 172 deletions

View File

@ -121,20 +121,24 @@ public class EaglerInputStream extends InputStream {
}
public static byte[] inputStreamToBytes(InputStream is) throws IOException {
if (is instanceof EaglerInputStream) {
return ((EaglerInputStream) is).getAsArray();
} else if (is instanceof ByteArrayInputStream) {
byte[] ret = new byte[is.available()];
is.read(ret);
return ret;
} else {
EaglerOutputStream os = new EaglerOutputStream(1024);
byte[] buf = new byte[1024];
int i;
while ((i = is.read(buf)) != -1) {
os.write(buf, 0, i);
try {
if (is instanceof EaglerInputStream) {
return ((EaglerInputStream) is).getAsArray();
} else if (is instanceof ByteArrayInputStream) {
byte[] ret = new byte[is.available()];
is.read(ret);
return ret;
} else {
EaglerOutputStream os = new EaglerOutputStream(1024);
byte[] buf = new byte[1024];
int i;
while ((i = is.read(buf)) != -1) {
os.write(buf, 0, i);
}
return os.toByteArray();
}
return os.toByteArray();
}finally {
is.close();
}
}