mirror of
https://github.com/github/codeql.git
synced 2025-12-18 09:43:15 +01:00
25 lines
687 B
Java
25 lines
687 B
Java
package p;
|
|
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.net.URL;
|
|
import java.nio.file.CopyOption;
|
|
import java.nio.charset.Charset;
|
|
import java.nio.file.Files;
|
|
import java.nio.file.Path;
|
|
|
|
public class Sinks {
|
|
|
|
public Path copyFileToDirectory(final Path sourceFile, final Path targetFile, final CopyOption... copyOptions) throws IOException {
|
|
return Files.copy(sourceFile, targetFile, copyOptions);
|
|
}
|
|
|
|
public String readUrl(final URL url, Charset encoding) throws IOException {
|
|
try (InputStream in = url.openStream()) {
|
|
byte[] bytes = in.readAllBytes();
|
|
return new String(bytes, encoding);
|
|
}
|
|
}
|
|
|
|
}
|