mirror of
https://github.com/github/codeql.git
synced 2026-04-26 17:25:19 +02:00
Support lambda flow for source models
Also rely on public API to detect the source node
This commit is contained in:
@@ -1 +1,3 @@
|
||||
| p;Sources;true;readUrl;(URL);;ReturnValue;remote; |
|
||||
| p;Sources;true;consumeSource;(int,Consumer);;Parameter[1];remote; |
|
||||
| p;Sources;true;readUrl;(URL);;ReturnValue;remote; |
|
||||
| p;Sources;true;socketStream;();;ReturnValue;remote; |
|
||||
@@ -2,7 +2,9 @@ package p;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.URL;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
|
||||
public class Sources {
|
||||
@@ -11,4 +13,13 @@ public class Sources {
|
||||
return url.openConnection().getInputStream();
|
||||
}
|
||||
|
||||
public InputStream socketStream() throws IOException {
|
||||
ServerSocket socket = new ServerSocket(123);
|
||||
return socket.accept().getInputStream();
|
||||
}
|
||||
|
||||
public void consumeSource(int port, Consumer<InputStream> consumer) throws IOException {
|
||||
ServerSocket socket = new ServerSocket(port);
|
||||
consumer.accept(socket.accept().getInputStream());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user