- java.lang.Object
-
- com.github.weisj.jsvg.util.DataUri
-
final class DataUri extends java.lang.ObjectCopyright (c) 2013 ooxi ...This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Note: This file has been modified for usage in the JSVG project.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classDataUri.MalformedDataUriException
-
Field Summary
Fields Modifier and Type Field Description private @Nullable java.nio.charset.Charsetcharsetprivate static java.lang.StringCHARSET_OPTION_NAMEprivate static java.lang.StringCONTENT_DISPOSITION_OPTION_NAMEprivate @Nullable java.lang.StringcontentDispositionprivate byte @NotNull []dataprivate @Nullable java.lang.Stringfilenameprivate static java.lang.StringFILENAME_OPTION_NAMEprivate @NotNull java.lang.Stringmimeprivate static java.util.regex.PatternPLUS
-
Constructor Summary
Constructors Constructor Description DataUri(@NotNull java.lang.String mime, @Nullable java.nio.charset.Charset charset, @Nullable java.lang.String filename, @Nullable java.lang.String contentDisposition, byte @NotNull [] data)DataUri(java.lang.String mime, java.nio.charset.Charset charset, byte[] data)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable java.nio.charset.Charsetcharset()@Nullable java.lang.StringcontentDisposition()byte @NotNull []data()booleanequals(java.lang.Object o)@Nullable java.lang.Stringfilename()inthashCode()@NotNull java.lang.Stringmime()static DataUriparse(@NotNull java.lang.String uri, java.nio.charset.Charset charset)Tries to parse a data URI described in RFC2397private static java.lang.StringpercentDecode(java.lang.String s, java.nio.charset.Charset cs)java.lang.StringtoString()
-
-
-
Field Detail
-
CHARSET_OPTION_NAME
private static final java.lang.String CHARSET_OPTION_NAME
- See Also:
- Constant Field Values
-
FILENAME_OPTION_NAME
private static final java.lang.String FILENAME_OPTION_NAME
- See Also:
- Constant Field Values
-
CONTENT_DISPOSITION_OPTION_NAME
private static final java.lang.String CONTENT_DISPOSITION_OPTION_NAME
- See Also:
- Constant Field Values
-
mime
@NotNull private final @NotNull java.lang.String mime
-
charset
@Nullable private final @Nullable java.nio.charset.Charset charset
-
filename
@Nullable private final @Nullable java.lang.String filename
-
contentDisposition
@Nullable private final @Nullable java.lang.String contentDisposition
-
data
private final byte @NotNull [] data
-
PLUS
private static final java.util.regex.Pattern PLUS
-
-
Constructor Detail
-
DataUri
public DataUri(java.lang.String mime, java.nio.charset.Charset charset, byte[] data)
-
DataUri
public DataUri(@NotNull @NotNull java.lang.String mime, @Nullable @Nullable java.nio.charset.Charset charset, @Nullable @Nullable java.lang.String filename, @Nullable @Nullable java.lang.String contentDisposition, byte @NotNull [] data)
-
-
Method Detail
-
mime
@NotNull public @NotNull java.lang.String mime()
-
data
public byte @NotNull [] data()
-
charset
@Nullable public @Nullable java.nio.charset.Charset charset()
-
contentDisposition
@Nullable public @Nullable java.lang.String contentDisposition()
-
filename
@Nullable public @Nullable java.lang.String filename()
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
parse
public static DataUri parse(@NotNull @NotNull java.lang.String uri, java.nio.charset.Charset charset) throws DataUri.MalformedDataUriException
Tries to parse a data URI described in RFC2397- Parameters:
uri- A string representing the data URIcharset- Charset to use when decoding percent encoded options like filename- Returns:
- Parsed data URI
- Throws:
java.lang.IllegalArgumentException- iff an error occurred during parse processDataUri.MalformedDataUriException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
percentDecode
private static java.lang.String percentDecode(java.lang.String s, java.nio.charset.Charset cs)
-
-