import java.util.Arrays; import java.util.Vector; public class JPEGUtils extends Const { public static int blockLength(int boundaryPos, byte[] data) { if(!JPEGUtils.isAPP1Marker(data,boundaryPos)) { System.err.println("JPEGUtils blockLength: Block is no APP1 Block!"); return -1; } int o; try { o = 256*(data[boundaryPos+2]&0xFF) + (data[boundaryPos+3]&0xFF); } catch(ArrayIndexOutOfBoundsException e) { System.err.println("JPEGUtils blockLength got ArrayIndexOutOfBoundsException:"); e.printStackTrace(); return -1; } return o; } public static byte[] decorateBlock(byte[] data, String type) { if(type.equals(EXIF)) { data = ArrayUtils.concatenate(markEXIF, data); byte[] pre = ArrayUtils.concatenate(markAPP1, genLen(data.length+2)); return ArrayUtils.concatenate(pre, data); } else if(type.equals(STANDARDXMP)) { data = ArrayUtils.concatenate(markStandardXMP, data); byte[] pre = ArrayUtils.concatenate(markAPP1, genLen(data.length+2)); return ArrayUtils.concatenate(pre,data); } else if(type.equals(EXTENDEDXMP)) { byte[] out = new byte[0]; byte[] md5 = HexUtil.generateMD5(data); int i=0; int blockCount = data.length/CHUNKSIZE; while (i b = new Vector(); for(int i=0; i