[FEATURE] BufferedInputStream/BufferedOutputStream

By PullRequest https://github.com/new-sashok724/Launcher/pull/72
This commit is contained in:
Gravit 2019-02-10 23:27:31 +07:00
parent ec7e64fdf4
commit acf8370c54
No known key found for this signature in database
GPG key ID: 061981E1E85D3216

View file

@ -338,23 +338,42 @@ public static Inflater newInflater() {
public static InputStream newInput(Path file) throws IOException {
return Files.newInputStream(file, READ_OPTIONS);
}
@LauncherAPI
public static InputStream newBufferedInput(Path file) throws IOException {
return new BufferedInputStream(Files.newInputStream(file, READ_OPTIONS));
}
@LauncherAPI
public static InputStream newInput(URL url) throws IOException {
return newConnection(url).getInputStream();
}
@LauncherAPI
public static BufferedInputStream newBufferedInput(URL url) throws IOException {
return new BufferedInputStream(newConnection(url).getInputStream());
}
@LauncherAPI
public static OutputStream newOutput(Path file) throws IOException {
return newOutput(file, false);
}
@LauncherAPI
public static OutputStream newBufferedOutput(Path file) throws IOException {
return newBufferedOutput(file, false);
}
@LauncherAPI
public static OutputStream newOutput(Path file, boolean append) throws IOException {
createParentDirs(file);
return Files.newOutputStream(file, append ? APPEND_OPTIONS : WRITE_OPTIONS);
}
@LauncherAPI
public static OutputStream newBufferedOutput(Path file, boolean append) throws IOException {
createParentDirs(file);
return new BufferedOutputStream(Files.newOutputStream(file, append ? APPEND_OPTIONS : WRITE_OPTIONS));
}
@LauncherAPI
public static BufferedReader newReader(InputStream input) {
return newReader(input, UNICODE_CHARSET);