public String getString(SpecificCharacterSet cs, boolean cache) { if (cache) { Object tmp = cachedValue; if (tmp instanceof String) return (String) tmp; } String val = vr.toString(value, bigEndian, cs); if (cache) cachedValue = val; return val; }
public Pattern toPattern(byte[] bs, boolean bigEndian, SpecificCharacterSet cs, boolean ignoreCase) { String s = toString(bs, bigEndian, cs); if (s == null) return null; StringBuffer sb = new StringBuffer(s.length() + 10); StringTokenizer stk = new StringTokenizer(s, "*?", true); while (stk.hasMoreTokens()) { String tk = stk.nextToken(); char c = tk.charAt(0); if (c == '*') { sb.append(".*"); } else if (c == '?') { sb.append("."); } else { sb.append("\\Q").append(tk).append("\\E"); } } return Pattern.compile(sb.toString(), ignoreCase ? (Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE) : 0); }
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); }
public TagValue(int tag, String alias) { this.tag = tag ; this.name = alias; this.alias = alias ; VR tagVR = (new BasicDicomObject()).vrOf(tag); if(tagVR != null) tgVR = tagVR.toString(); } /**