test_class.declarator: logger = LoggerFactory.getLogger(GsmUtilTest.class)
test_class.modifier: private static final
test_class.original_string: private static final Logger logger = LoggerFactory.getLogger(GsmUtilTest.class);
test_class.type: Logger
test_class.var_name: logger
test_class.file: ch-commons-gsm/src/test/java/com/cloudhopper/commons/gsm/GsmUtilTest.java
test_class.identifier: GsmUtilTest
test_case.body: @Test
      public void createConcatenatedBinaryShortMessages() {
          Assert.assertNull(GsmUtil.createConcatenatedBinaryShortMessages(null, (byte)0));
          // these don't need concatenated
          Assert.assertNull(GsmUtil.createConcatenatedBinaryShortMessages(new byte[0], (byte)0));
          Assert.assertNull(GsmUtil.createConcatenatedBinaryShortMessages(HexUtil.toByteArray("00"), (byte)0));
          Assert.assertNull(GsmUtil.createConcatenatedBinaryShortMessages(HexUtil.toByteArray("0001"), (byte)0));
          // full 140 bytes (boundary)
          Assert.assertNull(GsmUtil.createConcatenatedBinaryShortMessages(HexUtil.toByteArray("000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B"), (byte)0));
  
          // start of concatenated sms
          byte[][] smsParts = null;
  
          // 141 bytes (2 sms)
          smsParts = GsmUtil.createConcatenatedBinaryShortMessages(HexUtil.toByteArray("000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B8C"), (byte)2);
          Assert.assertArrayEquals(HexUtil.toByteArray("050003020201000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485"), smsParts[0]);
          Assert.assertArrayEquals(HexUtil.toByteArray("050003020202868788898A8B8C"), smsParts[1]);
  
          // 268 bytes (exactly 2 sms)
          smsParts = GsmUtil.createConcatenatedBinaryShortMessages(HexUtil.toByteArray("000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDFE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF000102030405060708090A0B"), (byte)2);
          Assert.assertArrayEquals(HexUtil.toByteArray("050003020201000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485"), smsParts[0]);
          Assert.assertArrayEquals(HexUtil.toByteArray("050003020202868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDFE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF000102030405060708090A0B"), smsParts[1]);
  
          // 269 bytes (3 sms)
          smsParts = GsmUtil.createConcatenatedBinaryShortMessages(HexUtil.toByteArray("000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDFE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF000102030405060708090A0B0C"), (byte)2);
          Assert.assertArrayEquals(HexUtil.toByteArray("050003020301000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485"), smsParts[0]);
          Assert.assertArrayEquals(HexUtil.toByteArray("050003020302868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDFE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF000102030405060708090A0B"), smsParts[1]);
          Assert.assertArrayEquals(HexUtil.toByteArray("0500030203030C"), smsParts[2]);
  
          // 267 bytes (2 sms)
          smsParts = GsmUtil.createConcatenatedBinaryShortMessages(HexUtil.toByteArray("000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDFE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF000102030405060708090A"), (byte)0xFF);
          Assert.assertArrayEquals(HexUtil.toByteArray("050003FF0201000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485"), smsParts[0]);
          Assert.assertArrayEquals(HexUtil.toByteArray("050003FF0202868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDFE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF000102030405060708090A"), smsParts[1]);
  
  
          /**
          int size = (134*2) + 1;
          byte[] d = new byte[size];
          for (int i = 0; i < size; i++) {
              d[i] = (byte)i;
          }
          logger.debug(size + ": " + HexUtil.toHexString(d));
           */
          
      }
test_case.class_method_signature: GsmUtilTest.createConcatenatedBinaryShortMessages()
test_case.full_signature: @Test public void createConcatenatedBinaryShortMessages()
test_case.identifier: createConcatenatedBinaryShortMessages
test_case.invocations: assertNull createConcatenatedBinaryShortMessages assertNull createConcatenatedBinaryShortMessages assertNull createConcatenatedBinaryShortMessages toByteArray assertNull createConcatenatedBinaryShortMessages toByteArray assertNull createConcatenatedBinaryShortMessages toByteArray createConcatenatedBinaryShortMessages toByteArray assertArrayEquals toByteArray assertArrayEquals toByteArray createConcatenatedBinaryShortMessages toByteArray assertArrayEquals toByteArray assertArrayEquals toByteArray createConcatenatedBinaryShortMessages toByteArray assertArrayEquals toByteArray assertArrayEquals toByteArray assertArrayEquals toByteArray createConcatenatedBinaryShortMessages toByteArray assertArrayEquals toByteArray assertArrayEquals toByteArray
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void createConcatenatedBinaryShortMessages()
focal_class.file: ch-commons-gsm/src/main/java/com/cloudhopper/commons/gsm/GsmUtil.java
focal_class.identifier: GsmUtil
focal_class.class_method_signature: GsmUtil.toBcd(String address)
focal_class.full_signature: public static byte[] toBcd(String address)
focal_class.identifier: toBcd
focal_class.modifiers: public static
focal_class.parameters: (String address)
focal_class.return: byte[]
focal_class.signature: byte[] toBcd(String address)
focal_class.class_method_signature: GsmUtil.toSubmitInfo(boolean replyPath, boolean udhIndicator,
              boolean deliveryReceipt, int validityPeriodFormat, boolean rejectDuplicates)
focal_class.full_signature: public static byte toSubmitInfo(boolean replyPath, boolean udhIndicator,
              boolean deliveryReceipt, int validityPeriodFormat, boolean rejectDuplicates)
focal_class.identifier: toSubmitInfo
focal_class.modifiers: public static
focal_class.parameters: (boolean replyPath, boolean udhIndicator,
              boolean deliveryReceipt, int validityPeriodFormat, boolean rejectDuplicates)
focal_class.return: byte
focal_class.signature: byte toSubmitInfo(boolean replyPath, boolean udhIndicator,
              boolean deliveryReceipt, int validityPeriodFormat, boolean rejectDuplicates)
focal_class.class_method_signature: GsmUtil.removeUserDataHeader(byte[] shortMessage)
focal_class.full_signature: static public byte[] removeUserDataHeader(byte[] shortMessage)
focal_class.identifier: removeUserDataHeader
focal_class.modifiers: static public
focal_class.parameters: (byte[] shortMessage)
focal_class.return: byte[]
focal_class.signature: byte[] removeUserDataHeader(byte[] shortMessage)
focal_class.class_method_signature: GsmUtil.getShortMessageUserData(byte[] shortMessage)
focal_class.full_signature: static public byte[] getShortMessageUserData(byte[] shortMessage)
focal_class.identifier: getShortMessageUserData
focal_class.modifiers: static public
focal_class.parameters: (byte[] shortMessage)
focal_class.return: byte[]
focal_class.signature: byte[] getShortMessageUserData(byte[] shortMessage)
focal_class.class_method_signature: GsmUtil.getShortMessageUserDataHeader(byte[] shortMessage)
focal_class.full_signature: static public byte[] getShortMessageUserDataHeader(byte[] shortMessage)
focal_class.identifier: getShortMessageUserDataHeader
focal_class.modifiers: static public
focal_class.parameters: (byte[] shortMessage)
focal_class.return: byte[]
focal_class.signature: byte[] getShortMessageUserDataHeader(byte[] shortMessage)
focal_class.class_method_signature: GsmUtil.createConcatenatedBinaryShortMessages(byte[] binaryShortMessage, byte referenceNum)
focal_class.full_signature: static public byte[][] createConcatenatedBinaryShortMessages(byte[] binaryShortMessage, byte referenceNum)
focal_class.identifier: createConcatenatedBinaryShortMessages
focal_class.modifiers: static public
focal_class.parameters: (byte[] binaryShortMessage, byte referenceNum)
focal_class.return: byte[][]
focal_class.signature: byte[][] createConcatenatedBinaryShortMessages(byte[] binaryShortMessage, byte referenceNum)
focal_method.body: static public byte[][] createConcatenatedBinaryShortMessages(byte[] binaryShortMessage, byte referenceNum) throws IllegalArgumentException {
          if (binaryShortMessage == null) {
              return null;
          }
          // if the short message does not need to be concatenated
          if (binaryShortMessage.length <= 140) {
              return null;
          }
  
          // since the UDH will be 6 bytes, we'll split the data into chunks of 134
          int numParts = (int) (binaryShortMessage.length / 134) + (binaryShortMessage.length % 134 != 0 ? 1 : 0);
          //logger.debug("numParts=" + numParts);
  
          byte[][] shortMessageParts = new byte[numParts][];
  
          for (int i = 0; i < numParts; i++) {
              // default this part length to max of 134
              int shortMessagePartLength = 134;
              if ((i + 1) == numParts) {
                  // last part (only need to add remainder)
                  shortMessagePartLength = binaryShortMessage.length - (i * 134);
              }
  
              //logger.debug("part " + i + " len: " + shortMessagePartLength);
  
              // part will be UDH (6 bytes) + length of part
              byte[] shortMessagePart = new byte[6 + shortMessagePartLength];
              // Field 1 (1 octet): Length of User Data Header, in this case 05.
              shortMessagePart[0] = (byte) 0x05;
              // Field 2 (1 octet): Information Element Identifier, equal to 00 (Concatenated short messages, 8-bit reference number)
              shortMessagePart[1] = (byte) 0x00;
              // Field 3 (1 octet): Length of the header, excluding the first two fields; equal to 03
              shortMessagePart[2] = (byte) 0x03;
              // Field 4 (1 octet): 00-FF, CSMS reference number, must be same for all the SMS parts in the CSMS
              shortMessagePart[3] = referenceNum;
              // Field 5 (1 octet): 00-FF, total number of parts. The value shall remain constant for every short message which makes up the concatenated short message. If the value is zero then the receiving entity shall ignore the whole information element
              shortMessagePart[4] = (byte) numParts;
              // Field 6 (1 octet): 00-FF, this part's number in the sequence. The value shall start at 1 and increment for every short message which makes up the concatenated short message. If the value is zero or greater than the value in Field 5 then the receiving entity shall ignore the whole information element. [ETSI Specification: GSM 03.40 Version 5.3.0: July 1996]
              shortMessagePart[5] = (byte) (i + 1);
  
              // copy this part's user data onto the end
              System.arraycopy(binaryShortMessage, (i * 134), shortMessagePart, 6, shortMessagePartLength);
              shortMessageParts[i] = shortMessagePart;
          }
  
          return shortMessageParts;
      }
focal_method.class_method_signature: GsmUtil.createConcatenatedBinaryShortMessages(byte[] binaryShortMessage, byte referenceNum)
focal_method.full_signature: static public byte[][] createConcatenatedBinaryShortMessages(byte[] binaryShortMessage, byte referenceNum)
focal_method.identifier: createConcatenatedBinaryShortMessages
focal_method.invocations: arraycopy
focal_method.modifiers: static public
focal_method.parameters: (byte[] binaryShortMessage, byte referenceNum)
focal_method.return: byte[][]
focal_method.signature: byte[][] createConcatenatedBinaryShortMessages(byte[] binaryShortMessage, byte referenceNum)