Class Handler
- java.lang.Object
-
- java.net.URLStreamHandler
-
- com.github.robtimus.net.protocol.data.Handler
-
public class Handler extends java.net.URLStreamHandlerA stream protocol handler for thedata:protocol as specified in RFC 2397.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.StringBASE64_POSTFIXprivate static intBASE64_POSTFIX_LENGTHstatic java.lang.StringPROTOCOLThe protocol name.
-
Constructor Summary
Constructors Constructor Description Handler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static java.nio.charset.CharsetgetCharset(MediaType mediaType)private byte[]getData(java.lang.String spec, int indexOfComma, int limit, MediaType mediaType, boolean base64Data)private MediaTypegetMediaType(java.lang.String spec, int start, int indexOfComma)private booleanisBase64Data(java.lang.String spec, int indexOfComma)protected DataURLConnectionopenConnection(java.net.URL u)protected DataURLConnectionopenConnection(java.net.URL u, java.net.Proxy p)protected voidparseURL(java.net.URL u, java.lang.String spec, int start, int limit)private intvalidateCommaPresent(java.lang.String spec, int start, int limit)private voidvalidateProtocol(java.net.URL u)
-
-
-
Field Detail
-
PROTOCOL
public static final java.lang.String PROTOCOL
The protocol name.- See Also:
- Constant Field Values
-
BASE64_POSTFIX
static final java.lang.String BASE64_POSTFIX
- See Also:
- Constant Field Values
-
BASE64_POSTFIX_LENGTH
private static final int BASE64_POSTFIX_LENGTH
-
-
Method Detail
-
openConnection
protected DataURLConnection openConnection(java.net.URL u)
- Specified by:
openConnectionin classjava.net.URLStreamHandler
-
openConnection
protected DataURLConnection openConnection(java.net.URL u, java.net.Proxy p)
- Overrides:
openConnectionin classjava.net.URLStreamHandler
-
parseURL
protected void parseURL(java.net.URL u, java.lang.String spec, int start, int limit)- Overrides:
parseURLin classjava.net.URLStreamHandler
-
validateProtocol
private void validateProtocol(java.net.URL u)
-
validateCommaPresent
private int validateCommaPresent(java.lang.String spec, int start, int limit)
-
getMediaType
private MediaType getMediaType(java.lang.String spec, int start, int indexOfComma)
-
isBase64Data
private boolean isBase64Data(java.lang.String spec, int indexOfComma)
-
getData
private byte[] getData(java.lang.String spec, int indexOfComma, int limit, MediaType mediaType, boolean base64Data)
-
getCharset
static java.nio.charset.Charset getCharset(MediaType mediaType)
-
-