**/
private static boolean shouldWrite(PngChunk c, int currentGroup) {
if (currentGroup == CHUNK_GROUP_2_PLTE)
return c.id.equals(ChunkHelper.PLTE);
if (currentGroup % 2 == 0)
throw new PngjOutputException("bad chunk group?");
int minChunkGroup, maxChunkGroup;
if (c.getOrderingConstraint().mustGoBeforePLTE())
minChunkGroup = maxChunkGroup = ChunksList.CHUNK_GROUP_1_AFTERIDHR;
else if (c.getOrderingConstraint().mustGoBeforeIDAT()) {
maxChunkGroup = ChunksList.CHUNK_GROUP_3_AFTERPLTE;