Пример #1
0
  /**
   * @param c - a component
   * @return packed component
   * @throws org.jpos.iso.ISOException
   */
  public byte[] pack(ISOComponent c) throws ISOException {
    int len;
    byte[] s = c.getBytes();

    if ((len = s.length) > getLength()) {
      throw new ISOException(
          "Invalid length "
              + len
              + " packing IF_FSTBINARY field "
              + c.getKey()
              + " max length="
              + getLength());
    }
    byte[] b = new byte[s.length + 1];
    System.arraycopy(s, 0, b, 0, s.length);
    b[b.length - 2] = terminator;
    return b;
  }