Added readline

pull/213/head
M66B 2 years ago
parent 36b0d6ba03
commit 7f82f9d4db

@ -2578,6 +2578,18 @@ public class Helper {
return os.toByteArray(); return os.toByteArray();
} }
public static String readLine(InputStream is, Charset charset) throws IOException {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
int b = is.read();
if (b < 0)
return null;
while (b >= 0 && b != '\n') {
bos.write(b);
b = is.read();
}
return new String(bos.toByteArray(), charset);
}
static void copy(File src, File dst) throws IOException { static void copy(File src, File dst) throws IOException {
try (InputStream is = new FileInputStream(src)) { try (InputStream is = new FileInputStream(src)) {
try (OutputStream os = new FileOutputStream(dst)) { try (OutputStream os = new FileOutputStream(dst)) {

Loading…
Cancel
Save