public class ChunkHelper extends Object
This should only be of interest to developers doing special chunk processing or extending the ChunkFactory
Modifier and Type | Field and Description |
---|---|
static byte[] |
b_IDAT |
static byte[] |
b_IEND |
static byte[] |
b_IHDR |
static byte[] |
b_PLTE |
static String |
bKGD |
static String |
cHRM |
static String |
gAMA |
static String |
hIST |
static String |
iCCP |
static String |
IDAT |
static String |
IEND |
static String |
IHDR |
static String |
iTXt |
static String |
pHYs |
static String |
PLTE |
static String |
sBIT |
static String |
sPLT |
static String |
sRGB |
static String |
tEXt |
static String |
tIME |
static String |
tRNS |
static String |
zTXt |
Modifier and Type | Method and Description |
---|---|
static byte[] |
compressBytes(byte[] ori,
boolean compress) |
static byte[] |
compressBytes(byte[] ori,
int offset,
int len,
boolean compress) |
static boolean |
equivalent(PngChunk c1,
PngChunk c2)
Adhoc criteria: two ancillary chunks are "equivalent" ("practically same type") if they have same id and (perhaps,
if multiple are allowed) if the match also in some "internal key" (eg: key for string values, palette for sPLT,
etc)
When we use this method, we implicitly assume that we don't allow/expect two "equivalent" chunks in a single PNG
Notice that the use of this is optional, and that the PNG standard actually allows text chunks that have same key
|
static List<PngChunk> |
filterList(List<PngChunk> target,
ChunkPredicate predicateKeep)
Returns only the chunks that "match" the predicate
See also trimList()
|
static boolean |
isCritical(String id)
critical chunk : first letter is uppercase
|
static boolean |
isPublic(String id)
public chunk: second letter is uppercase
|
static boolean |
isSafeToCopy(String id)
Safe to copy chunk: fourth letter is lower case
|
static boolean |
isText(PngChunk c) |
static boolean |
isUnknown(PngChunk c)
"Unknown" just means that our chunk factory (even when it has been augmented by client code) did not recognize its
id
|
static int |
posNullByte(byte[] b)
Finds position of null byte in array
|
static boolean |
shouldLoad(String id,
ChunkLoadBehaviour behav)
Decides if a chunk should be loaded, according to a ChunkLoadBehaviour
|
static byte[] |
toBytes(String x)
Converts to bytes using Latin1 (ISO-8859-1)
|
static byte[] |
toBytesUTF8(String x)
Converts to bytes using UTF-8
|
static String |
toString(byte[] x)
Converts to String using Latin1 (ISO-8859-1)
|
static String |
toString(byte[] x,
int offset,
int len)
Converts to String using Latin1 (ISO-8859-1)
|
static String |
toStringUTF8(byte[] x)
Converts to string using UTF-8
|
static String |
toStringUTF8(byte[] x,
int offset,
int len)
Converts to string using UTF-8
|
static int |
trimList(List<PngChunk> target,
ChunkPredicate predicateRemove)
Remove (in place) the chunks that "match" the predicate
See also filterList
|
public static final String IHDR
public static final String PLTE
public static final String IDAT
public static final String IEND
public static final String cHRM
public static final String gAMA
public static final String iCCP
public static final String sBIT
public static final String sRGB
public static final String bKGD
public static final String hIST
public static final String tRNS
public static final String pHYs
public static final String sPLT
public static final String tIME
public static final String iTXt
public static final String tEXt
public static final String zTXt
public static final byte[] b_IHDR
public static final byte[] b_PLTE
public static final byte[] b_IDAT
public static final byte[] b_IEND
public static byte[] toBytes(String x)
public static String toString(byte[] x)
public static String toString(byte[] x, int offset, int len)
public static byte[] toBytesUTF8(String x)
public static String toStringUTF8(byte[] x)
public static String toStringUTF8(byte[] x, int offset, int len)
public static boolean isCritical(String id)
public static boolean isPublic(String id)
public static boolean isSafeToCopy(String id)
public static boolean isUnknown(PngChunk c)
public static int posNullByte(byte[] b)
b
- public static boolean shouldLoad(String id, ChunkLoadBehaviour behav)
id
- behav
- public static final byte[] compressBytes(byte[] ori, boolean compress)
public static byte[] compressBytes(byte[] ori, int offset, int len, boolean compress)
public static List<PngChunk> filterList(List<PngChunk> target, ChunkPredicate predicateKeep)
public static int trimList(List<PngChunk> target, ChunkPredicate predicateRemove)
public static final boolean equivalent(PngChunk c1, PngChunk c2)
public static boolean isText(PngChunk c)
Copyright © 2014. All rights reserved.