Package de.sfuhrm.radiorecorder.http
Interface HttpConnection
- All Superinterfaces:
AutoCloseable
Wrapper for an open HTTP protocol connection.
- Author:
- Stephan Fuhrmann
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Get the content type of the stream.Get the response header fields from the HTTP server.Get the input stream reading the HTTP response body.intGet the HTTP server response code.Get the HTTP server response status message.getURL()Get the URL being associated to this connection.
-
Method Details
-
getURL
Get the URL being associated to this connection.- Returns:
- the URL associated with this connection.
- Throws:
IOException- if resolving the URL resulted in an error.
-
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
Get the input stream reading the HTTP response body.- Returns:
- the input stream of the connection.
- Throws:
IOException- if there's a problem getting or opening the input stream.
-
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
Get the HTTP server response code.- Returns:
- the numerical response code, for example 200 for "OK".
- Throws:
IOException- if there is a problem getting the response code.- See Also:
-
getResponseMessage
Get the HTTP server response status message.- Returns:
- the textual response message, for example "OK".
- Throws:
IOException- if there is a problem getting the response message.- See Also:
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
IOException
-