@Test public void testCltu1() { BchCltuGenerator g = new BchCltuGenerator(false); byte[] cltu = g.makeCltu(TC_FRAME_01); assertArrayEquals(CLTU_01, cltu); }
@Override public byte[] makeCltu(byte[] data) { if (randomize) { randomize(data); } int numBlocks = (data.length - 1) / 7 + 1; int length = startSeq.length + 8 * numBlocks + tailSeq.length; byte[] encData = new byte[length]; System.arraycopy(startSeq, 0, encData, 0, startSeq.length); int inOffset = 0; int outOffset = startSeq.length; int n = data.length / 7; for (int i = 0; i < n; i++) { System.arraycopy(data, inOffset, encData, outOffset, 7); encData[outOffset + 7] = BchEncoder.encode(encData, outOffset); outOffset += 8; inOffset += 7; } int d = data.length - inOffset; if (d > 0) { System.arraycopy(data, inOffset, encData, outOffset, d); for (int i = 0; i < 7 - d; i++) { encData[outOffset + d + i] = 0x55; } encData[outOffset + 7] = BchEncoder.encode(encData, outOffset); outOffset += 8; } System.arraycopy(tailSeq, 0, encData, outOffset, tailSeq.length); return encData; }
BchCltuGenerator extends CltuGenerator { @Override public byte[] makeCltu(byte[] data) { if (randomize) { randomize(data); } int numBlocks = (data.length - 1) / 7 + 1; int length = startSeq.length + 8 * numBlocks + tailSeq.length; byte[] encData = new byte[length]; System.arraycopy(startSeq, 0, encData, 0, startSeq.length); int inOffset = 0; int outOffset = startSeq.length; int n = data.length / 7; for (int i = 0; i < n; i++) { System.arraycopy(data, inOffset, encData, outOffset, 7); encData[outOffset + 7] = BchEncoder.encode(encData, outOffset); outOffset += 8; inOffset += 7; } int d = data.length - inOffset; if (d > 0) { System.arraycopy(data, inOffset, encData, outOffset, d); for (int i = 0; i < 7 - d; i++) { encData[outOffset + d + i] = 0x55; } encData[outOffset + 7] = BchEncoder.encode(encData, outOffset); outOffset += 8; } System.arraycopy(tailSeq, 0, encData, outOffset, tailSeq.length); return encData; } }
BchCltuGenerator extends CltuGenerator { @Override public byte[] makeCltu(byte[] data) { if (randomize) { randomize(data); } int numBlocks = (data.length - 1) / 7 + 1; int length = startSeq.length + 8 * numBlocks + tailSeq.length; byte[] encData = new byte[length]; System.arraycopy(startSeq, 0, encData, 0, startSeq.length); int inOffset = 0; int outOffset = startSeq.length; int n = data.length / 7; for (int i = 0; i < n; i++) { System.arraycopy(data, inOffset, encData, outOffset, 7); encData[outOffset + 7] = BchEncoder.encode(encData, outOffset); outOffset += 8; inOffset += 7; } int d = data.length - inOffset; if (d > 0) { System.arraycopy(data, inOffset, encData, outOffset, d); for (int i = 0; i < 7 - d; i++) { encData[outOffset + d + i] = 0x55; } encData[outOffset + 7] = BchEncoder.encode(encData, outOffset); outOffset += 8; } System.arraycopy(tailSeq, 0, encData, outOffset, tailSeq.length); return encData; } BchCltuGenerator(boolean randomize);  BchCltuGenerator(boolean randomize, byte[] startSeq, byte[] tailSeq); }
BchCltuGenerator extends CltuGenerator { @Override public byte[] makeCltu(byte[] data) { if (randomize) { randomize(data); } int numBlocks = (data.length - 1) / 7 + 1; int length = startSeq.length + 8 * numBlocks + tailSeq.length; byte[] encData = new byte[length]; System.arraycopy(startSeq, 0, encData, 0, startSeq.length); int inOffset = 0; int outOffset = startSeq.length; int n = data.length / 7; for (int i = 0; i < n; i++) { System.arraycopy(data, inOffset, encData, outOffset, 7); encData[outOffset + 7] = BchEncoder.encode(encData, outOffset); outOffset += 8; inOffset += 7; } int d = data.length - inOffset; if (d > 0) { System.arraycopy(data, inOffset, encData, outOffset, d); for (int i = 0; i < 7 - d; i++) { encData[outOffset + d + i] = 0x55; } encData[outOffset + 7] = BchEncoder.encode(encData, outOffset); outOffset += 8; } System.arraycopy(tailSeq, 0, encData, outOffset, tailSeq.length); return encData; } BchCltuGenerator(boolean randomize);  BchCltuGenerator(boolean randomize, byte[] startSeq, byte[] tailSeq); @Override byte[] makeCltu(byte[] data); }
BchCltuGenerator extends CltuGenerator { @Override public byte[] makeCltu(byte[] data) { if (randomize) { randomize(data); } int numBlocks = (data.length - 1) / 7 + 1; int length = startSeq.length + 8 * numBlocks + tailSeq.length; byte[] encData = new byte[length]; System.arraycopy(startSeq, 0, encData, 0, startSeq.length); int inOffset = 0; int outOffset = startSeq.length; int n = data.length / 7; for (int i = 0; i < n; i++) { System.arraycopy(data, inOffset, encData, outOffset, 7); encData[outOffset + 7] = BchEncoder.encode(encData, outOffset); outOffset += 8; inOffset += 7; } int d = data.length - inOffset; if (d > 0) { System.arraycopy(data, inOffset, encData, outOffset, d); for (int i = 0; i < 7 - d; i++) { encData[outOffset + d + i] = 0x55; } encData[outOffset + 7] = BchEncoder.encode(encData, outOffset); outOffset += 8; } System.arraycopy(tailSeq, 0, encData, outOffset, tailSeq.length); return encData; } BchCltuGenerator(boolean randomize);  BchCltuGenerator(boolean randomize, byte[] startSeq, byte[] tailSeq); @Override byte[] makeCltu(byte[] data); static final byte[] CCSDS_START_SEQ; static final byte[] CCSDS_TAIL_SEQ; }