public static UJIRaw getInstance(byte[] block0, byte[] block1, byte[] block2) throws UJIDataException { UJIRaw testRaw = new UJIRaw(block0, block1, block2); // Se verifica la firma String signature = new String(testRaw.block0, 2, SIGNATURE.length()); if (!signature.equals(SIGNATURE)) throw new UJIDataException("Invalid SIGNATURE"); // Verificamos el CRC checkCRC(testRaw.getCRC(), testRaw.calcCRC()); return testRaw; }
public static UJIRaw getInstance(UJIData testData) { byte[] block0 = new byte[16]; byte[] block1 = new byte[16]; byte[] block2 = new byte[16]; System.arraycopy(cero, 0, block0, 0, cero.length); System.arraycopy(cero, 0, block1, 0, cero.length); System.arraycopy(cero, 0, block2, 0, cero.length); System.arraycopy(SIGNATURE.getBytes(), 0, block0, 2, SIGNATURE.length()); UJIRaw testRaw = new UJIRaw(block0, block1, block2); testRaw.setData(testData); return testRaw; }
public static UJIRaw getInstance(byte[][] blocks) throws UJIDataException { if (blocks == null || blocks.length != 3) { throw new UJIDataException("Invalid blocks count"); } return UJIRaw.getInstance(blocks[0], blocks[1], blocks[2]); }