@Override
  public byte[] pack(ISOComponent c) throws ISOException {
    try {
      String data = (String) c.getValue();
      //		      System.out.println(data);

      String paddedData = padder.pad(data, getLength());
      byte[] rawData =
          new byte
              [prefixer.getPackedLength()
                  + interpreter.getPackedLength(paddedData.getBytes().length)];
      prefixer.encodeLength(paddedData.getBytes().length, rawData);
      interpreter.interpret(paddedData, rawData, prefixer.getPackedLength());
      return rawData;
    } catch (Exception e) {
      e.printStackTrace();
      throw new ISOException(makeExceptionMessage(c, "packing"), e);
    }
  }
 /**
  * @see
  *     com.newland.message.packager.FieldPackager.iso.ISOFieldPackager#unpack(org.jpos.iso.ISOComponent,
  *     byte[], int)
  */
 public int unpack(IField<?> c, byte[] b, int offset) throws MessageException {
   try {
     int len = prefixer.decodeLength(b, offset);
     if (len == -1) {
       // The prefixer doesn't know how long the field is, so use
       // maxLength instead
       len = getLength();
     }
     int lenLen = prefixer.getPackedLength();
     byte[] unpacked = interpreter.uninterpret(b, offset + lenLen, len);
     // logger.debug("当前解析域值:["+CodecUtils.hexString(unpacked)+"]");
     ((IField<byte[]>) c).setValue(unpacked);
     return lenLen + interpreter.getPackedLength(len);
   } catch (Exception e) {
     throw new MessageException(makeExceptionMessage(c, "unpacking"), e);
   }
 }
  @Override
  public int unpack(ISOComponent c, byte[] b, int offset) throws ISOException {
    try {
      int len = prefixer.decodeLength(b, offset);
      if (len == -1) {
        // The prefixer doesn't know how long the field is, so use
        // maxLength instead
        len = getLength(b, offset);
      }

      int lenLen = prefixer.getPackedLength();
      String unpacked = interpreter.uninterpret(b, offset + lenLen, len);

      c.setValue(unpacked);
      return lenLen + interpreter.getPackedLength(len);
    } catch (Exception e) {
      throw new ISOException(makeExceptionMessage(c, "unpacking"), e);
    }
  }
 /** Convert the component into a byte[]. */
 public byte[] pack(IField<?> c) throws MessageException {
   try {
     byte[] data = (byte[]) c.getValue();
     int packedLength = prefixer.getPackedLength();
     if (packedLength == 0) {
       if (data.length != getLength()) {
         throw new MessageException(
             "Binary data length not the same as the packager length ("
                 + data.length
                 + "/"
                 + getLength()
                 + ")");
       }
     }
     byte[] ret = new byte[interpreter.getPackedLength(data.length) + packedLength];
     prefixer.encodeLength(data.length, ret);
     interpreter.interpret(data, ret, packedLength);
     return ret;
   } catch (Exception e) {
     throw new MessageException(makeExceptionMessage(c, "packing"), e);
   }
 }