Package de.sfuhrm.radiorecorder.http
Interface HttpConnection
-
- All Superinterfaces:
AutoCloseable
public interface HttpConnection extends AutoCloseable
Wrapper for an open HTTP protocol connection.- Author:
- Stephan Fuhrmann
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()StringgetContentType()Get the content type of the stream.Map<String,List<String>>getHeaderFields()Get the response header fields from the HTTP server.InputStreamgetInputStream()Get the input stream reading the HTTP response body.intgetResponseCode()Get the HTTP server response code.StringgetResponseMessage()Get the HTTP server response status message.URLgetURL()Get the URL being associated to this connection.
-
-
-
Method Detail
-
getURL
URL getURL() throws IOException
Get the URL being associated to this connection.- Throws:
IOException
-
getHeaderFields
Map<String,List<String>> getHeaderFields()
Get the response header fields from the HTTP server.- Returns:
- a map with the keys being headers field names and the values being header field values. If a header field is given multiple times the value list will contain all values.
-
getInputStream
InputStream getInputStream() throws IOException
Get the input stream reading the HTTP response body.- Throws:
IOException
-
getContentType
String getContentType()
Get the content type of the stream.- Returns:
- the content type, for example "audio/mpeg", or
nullif not sent by the server.
-
getResponseCode
int getResponseCode() throws IOExceptionGet the HTTP server response code.- Returns:
- the numerical response code, for example 200 for "OK".
- Throws:
IOException- See Also:
getResponseMessage()
-
getResponseMessage
String getResponseMessage() throws IOException
Get the HTTP server response status message.- Returns:
- the textual response message, for example "OK".
- Throws:
IOException- See Also:
getResponseCode()
-
close
void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Throws:
IOException
-
-