mirror of
https://github.com/github/codeql.git
synced 2025-12-18 01:33:15 +01:00
29 lines
791 B
Java
29 lines
791 B
Java
package p;
|
|
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.net.ServerSocket;
|
|
import java.net.URL;
|
|
import java.util.function.Consumer;
|
|
import java.util.List;
|
|
|
|
|
|
public class Sources {
|
|
|
|
public InputStream readUrl(final URL url) throws IOException {
|
|
return url.openConnection().getInputStream();
|
|
}
|
|
|
|
public InputStream socketStream() throws IOException {
|
|
ServerSocket socket = new ServerSocket(123);
|
|
return socket.accept().getInputStream();
|
|
}
|
|
|
|
public void sourceToParameter(InputStream[] streams, List<InputStream> otherStreams) throws IOException {
|
|
ServerSocket socket = new ServerSocket(123);
|
|
streams[0] = socket.accept().getInputStream();
|
|
otherStreams.add(socket.accept().getInputStream());
|
|
}
|
|
|
|
}
|