1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-02-22 06:01:12 +00:00

Added readline

This commit is contained in:
M66B 2023-07-07 09:17:01 +02:00
parent 36b0d6ba03
commit 7f82f9d4db

View file

@ -2578,6 +2578,18 @@ public class Helper {
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 {
try (InputStream is = new FileInputStream(src)) {
try (OutputStream os = new FileOutputStream(dst)) {