Example #1
0
  @Nullable
  protected String getAsciiStringFromBytes(int tag) {
    byte[] values = _directory.getByteArray(tag);

    if (values == null) return null;

    try {
      return new String(values, "ASCII").trim();
    } catch (UnsupportedEncodingException e) {
      return null;
    }
  }
Example #2
0
  @Nullable
  protected String get7BitStringFromBytes(final int tagType) {
    final byte[] bytes = _directory.getByteArray(tagType);

    if (bytes == null) return null;

    int length = bytes.length;
    for (int index = 0; index < bytes.length; index++) {
      int i = bytes[index] & 0xFF;
      if (i == 0 || i > 0x7F) {
        length = index;
        break;
      }
    }

    return new String(bytes, 0, length);
  }
Example #3
0
 @Nullable
 protected String getByteLengthDescription(final int tagType) {
   byte[] bytes = _directory.getByteArray(tagType);
   if (bytes == null) return null;
   return String.format("(%d byte%s)", bytes.length, bytes.length == 1 ? "" : "s");
 }