Class DataURLs
java.lang.Object
com.github.robtimus.net.protocol.data.DataURLs
A utility class for data URLs.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final classstatic classA class that can be used to build data URLs. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DataURLs.Builder.FromBytesbuilder(byte[] data) Creates a new data URL builder.static DataURLs.Builder.FromBytesbuilder(InputStream data) Creates a new data URL builder.static DataURLs.Builder.FromTextCreates a new data URL builder.static DataURLs.Builder.FromTextCreates a new data URL builder.private static voidcopyData(InputStream data, OutputStream dest) private static voidcopyData(Reader data, StringBuilder dest) static URLCreates a new data URL for the given full URL string.
-
Field Details
-
SHARED_HANDLER
-
-
Constructor Details
-
DataURLs
private DataURLs()
-
-
Method Details
-
create
Creates a new data URL for the given full URL string.- Parameters:
spec- The string to create a new data URL for.- Returns:
- The created data URL.
- Throws:
MalformedURLException- If the given URL string is invalid.
-
builder
Creates a new data URL builder.- Parameters:
data- The data for created data URLs.- Returns:
- The created builder.
-
builder
Creates a new data URL builder.Note: the builder's
DataURLs.Builder.build()method will fail with anUncheckedIOExceptionif an I/O error occurs while reading from the data stream.- Parameters:
data- The data for created data URLs.- Returns:
- The created builder.
-
builder
Creates a new data URL builder.- Parameters:
data- The data for created data URLs.- Returns:
- The created builder.
-
builder
Creates a new data URL builder.Note: the builder's
DataURLs.Builder.build()method will fail with anUncheckedIOExceptionif an I/O error occurs while reading from the data stream.- Parameters:
data- The data for created data URLs.- Returns:
- The created builder.
-
copyData
-
copyData
- Throws:
IOException
-