public static class WrappedServerPing.CompressedImage
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected byte[] |
data |
protected java.lang.String |
encoded |
protected java.lang.String |
mime |
Modifier | Constructor and Description |
---|---|
protected |
WrappedServerPing.CompressedImage()
Represents a compressed image with no content.
|
|
WrappedServerPing.CompressedImage(java.lang.String mime,
byte[] data)
Construct a new compressed image.
|
Modifier and Type | Method and Description |
---|---|
static WrappedServerPing.CompressedImage |
fromBase64Png(java.lang.String base64)
Retrieve a compressed image from a base-64 encoded PNG file.
|
static WrappedServerPing.CompressedImage |
fromEncodedText(java.lang.String text)
Retrieve a compressed image from an encoded text.
|
static WrappedServerPing.CompressedImage |
fromPng(byte[] data)
Retrieve a compressed image from a byte array of a PNG file.
|
static WrappedServerPing.CompressedImage |
fromPng(java.io.InputStream input)
Retrieve a compressed image from an input stream.
|
static WrappedServerPing.CompressedImage |
fromPng(java.awt.image.RenderedImage image)
Retrieve a compressed image from an image.
|
protected byte[] |
getData()
Retrieve the underlying data, with no copying.
|
byte[] |
getDataCopy()
Retrieve a copy of the underlying data array.
|
java.awt.image.BufferedImage |
getImage()
Uncompress and return the stored image.
|
java.lang.String |
getMime()
Retrieve the MIME type of the image.
|
java.lang.String |
toEncodedText()
Convert the compressed image to encoded text.
|
protected volatile java.lang.String mime
protected volatile byte[] data
protected volatile java.lang.String encoded
protected WrappedServerPing.CompressedImage()
public WrappedServerPing.CompressedImage(java.lang.String mime, byte[] data)
mime
- - the mime type.data
- - the raw compressed image data.public static WrappedServerPing.CompressedImage fromPng(java.io.InputStream input) throws java.io.IOException
input
- - the PNG as an input stream.java.io.IOException
- If we cannot read the input stream.public static WrappedServerPing.CompressedImage fromPng(byte[] data)
data
- - the file as a byte array.public static WrappedServerPing.CompressedImage fromBase64Png(java.lang.String base64)
base64
- - the base 64-encoded PNG.public static WrappedServerPing.CompressedImage fromPng(java.awt.image.RenderedImage image) throws java.io.IOException
image
- - the image.java.io.IOException
- If we were unable to compress the image.public static WrappedServerPing.CompressedImage fromEncodedText(java.lang.String text)
text
- - the encoded text.public java.lang.String getMime()
This is image/png in vanilla Minecraft.
public byte[] getDataCopy()
protected byte[] getData()
public java.awt.image.BufferedImage getImage() throws java.io.IOException
java.io.IOException
- If the image data could not be decoded.public java.lang.String toEncodedText()