Package io.cucumber.core.plugin
Class UrlOutputStream
java.lang.Object
java.io.OutputStream
io.cucumber.core.plugin.UrlOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CurlOptionprivate final Pathprivate final OutputStreamprivate final @Nullable UrlReporter -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()private static IOExceptioncreateCurlLikeException(String method, URL url, Map<String, List<String>> requestHeaders, Map<String, List<String>> responseHeaders, String responseBody, @Nullable Exception e) voidflush()private static StringgetResponseBody(HttpURLConnection urlConnection, Map<String, List<String>> requestHeaders) private static Stringprivate static HttpURLConnectionopenConnection(Proxy proxy, URL url, CurlOption.HttpMethod method) sendRequest(Proxy proxy, URL url, CurlOption.HttpMethod method, boolean setHeaders) private static voidsendRequestBody(HttpURLConnection urlConnection, Map<String, List<String>> requestHeaders, Path requestBody) voidwrite(byte[] buffer) voidwrite(byte[] buffer, int offset, int count) voidwrite(int b) Methods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
urlReporter
-
option
-
temp
-
tempOutputStream
-
-
Constructor Details
-
UrlOutputStream
UrlOutputStream(CurlOption option, @Nullable UrlReporter urlReporter) throws IOException - Throws:
IOException
-
-
Method Details
-
write
- Specified by:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
sendRequest
private Optional<String> sendRequest(Proxy proxy, URL url, CurlOption.HttpMethod method, boolean setHeaders) throws IOException - Throws:
IOException
-
openConnection
private static HttpURLConnection openConnection(Proxy proxy, URL url, CurlOption.HttpMethod method) throws IOException - Throws:
IOException
-
sendRequestBody
private static void sendRequestBody(HttpURLConnection urlConnection, Map<String, List<String>> requestHeaders, Path requestBody) throws IOException- Throws:
IOException
-
getResponseBody
private static String getResponseBody(HttpURLConnection urlConnection, Map<String, List<String>> requestHeaders) throws IOException- Throws:
IOException
-
createCurlLikeException
-
headersToString
-