public static String[] intsToHex(int[] val) { if (val == null || val.length == 0) return EMPTY_STRING_ARRAY; String[] ss = new String[val.length]; for (int i = 0; i < ss.length; i++) { ss[i] = intToHex(val[i]); } return ss; }
public static String intToHex(int val) { char[] ch = new char[8]; intToHex(val, ch, 0); return new String(ch); }
@Override public String toString(byte[] val, boolean bigEndian, SpecificCharacterSet cs) { if (val == null || val.length == 0) return null; return StringUtils.intToHex(toInt(val, bigEndian)); }
private void startAttributeElement(int tag, VR vr, int vallen, String fpath, DicomObject attrs) throws SAXException { if (lh != null) { String name = attrs.nameOf(tag); lh.comment(name.toCharArray(), 0, name.length()); } AttributesImpl atts = new AttributesImpl(); atts.addAttribute("", ATTR_TAG, ATTR_TAG, "", StringUtils.intToHex(tag)); atts.addAttribute("", ATTR_VR, ATTR_VR, "", vr.toString()); atts.addAttribute("", ATTR_LEN, ATTR_LEN, "", Integer.toString(vallen)); if (fpath != null) { atts.addAttribute("", ATTR_SRC, ATTR_SRC, "", fpath); } ch.startElement("", TAG_ATTR, TAG_ATTR, atts); }
private void writeElement(DicomObject attrs, DicomElement a) throws SAXException, IOException { VR vr = a.vr(); final int tag = a.tag(); if (file != null) file = new File(file, StringUtils.intToHex(tag)); String fpath = fpath(tag, vr, a.length()); startAttributeElement(tag, vr, a.length(), fpath, attrs); if (a.hasItems()) { for (int i = 0, n = a.countItems(); i < n; ++i) { writeItem(a, i); } } else { if (fpath != null) { writeToFile(a.getBytes()); } else { vr.formatXMLValue(a.getBytes(), a.bigEndian(), attrs.getSpecificCharacterSet(), cbuf, ch); } } endAttributeElement(); if (file != null) file = file.getParentFile(); }
final int vallen = in.valueLength(); final DicomObject attrs = in.getDicomObject(); final String tagHex = StringUtils.intToHex(tag); if (file != null) file = new File(file, tagHex);