Record Class PngInfo
java.lang.Object
java.lang.Record
net.minecraft.util.PngInfo
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final byteThe field for thebitDepthrecord component.private static final byteprivate static final byteprivate static final byteprivate static final byteprivate static final byteprivate final byteThe field for thecolorTyperecord component.private static final HexFormatprivate final intThe field for theheightrecord component.private static final intprivate static final intprivate static final intprivate static final intprivate static final longprivate static final intprivate final intThe field for thewidthrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionPngInfo(int width, int height, byte bitDepth, byte colorType) Creates an instance of aPngInforecord class. -
Method Summary
Modifier and TypeMethodDescriptionbytebitDepth()Returns the value of thebitDepthrecord component.byteReturns the value of thecolorTyperecord component.final booleanIndicates whether some other object is "equal to" this one.static PngInfofromBytes(byte[] bytes) static PngInfofromStream(InputStream inputStream) final inthashCode()Returns a hash code value for this object.intheight()Returns the value of theheightrecord component.final StringtoString()Returns a string representation of this record class.private static booleanvalidateBitDepth(int bitDepth) private static booleanvalidateBounds(int width, int height, byte bitDepth, byte colorType) private static booleanvalidateColorType(int colorType) static voidvalidateHeader(ByteBuffer buffer) intwidth()Returns the value of thewidthrecord component.
-
Field Details
-
width
private final int widthThe field for thewidthrecord component. -
height
private final int heightThe field for theheightrecord component. -
bitDepth
private final byte bitDepthThe field for thebitDepthrecord component. -
colorType
private final byte colorTypeThe field for thecolorTyperecord component. -
FORMAT
-
PNG_HEADER_SIZE
private static final int PNG_HEADER_SIZE- See Also:
-
PNG_HEADER
private static final long PNG_HEADER- See Also:
-
PNG_CHUNK_HEADER_SIZE
private static final int PNG_CHUNK_HEADER_SIZE- See Also:
-
PNG_CHUNK_TRAILER_SIZE
private static final int PNG_CHUNK_TRAILER_SIZE- See Also:
-
IHDR_TYPE
private static final int IHDR_TYPE- See Also:
-
IHDR_SIZE
private static final int IHDR_SIZE- See Also:
-
COLOR_TYPE_GRAYSCALE
private static final byte COLOR_TYPE_GRAYSCALE- See Also:
-
COLOR_TYPE_TRUECOLOR
private static final byte COLOR_TYPE_TRUECOLOR- See Also:
-
COLOR_TYPE_INDEXED
private static final byte COLOR_TYPE_INDEXED- See Also:
-
COLOR_TYPE_GRAYSCALE_ALPHA
private static final byte COLOR_TYPE_GRAYSCALE_ALPHA- See Also:
-
COLOR_TYPE_TRUECOLOR_ALPHA
private static final byte COLOR_TYPE_TRUECOLOR_ALPHA- See Also:
-
-
Constructor Details
-
PngInfo
public PngInfo(int width, int height, byte bitDepth, byte colorType) Creates an instance of aPngInforecord class.- Parameters:
width- the value for thewidthrecord componentheight- the value for theheightrecord componentbitDepth- the value for thebitDepthrecord componentcolorType- the value for thecolorTyperecord component
-
-
Method Details
-
fromStream
- Throws:
IOException
-
fromBytes
- Throws:
IOException
-
validateHeader
- Throws:
IOException
-
validateBitDepth
private static boolean validateBitDepth(int bitDepth) -
validateColorType
private static boolean validateColorType(int colorType) -
validateBounds
private static boolean validateBounds(int width, int height, byte bitDepth, byte colorType) -
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
width
public int width()Returns the value of thewidthrecord component.- Returns:
- the value of the
widthrecord component
-
height
public int height()Returns the value of theheightrecord component.- Returns:
- the value of the
heightrecord component
-
bitDepth
public byte bitDepth()Returns the value of thebitDepthrecord component.- Returns:
- the value of the
bitDepthrecord component
-
colorType
public byte colorType()Returns the value of thecolorTyperecord component.- Returns:
- the value of the
colorTyperecord component
-