@Override
public void readValue(DicomInputStream dis, Attributes attrs)
throws IOException {
int tag = dis.tag();
VR vr = dis.vr();
int len = dis.length();
if (TagUtils.isGroupLength(tag) || TagUtils.isPrivateCreator(tag)) {
dis.readValue(dis, attrs);
} else if (dis.getIncludeBulkData() == IncludeBulkData.NO
&& dis.isBulkData(attrs)) {
if (len == -1)
dis.readValue(dis, attrs);
else
dis.skipFully(len);
} else try {
String privateCreator = attrs.getPrivateCreator(tag);
addAttributes(tag, vr, privateCreator);
startElement("DicomAttribute");
if (vr == VR.SQ || len == -1) {
dis.readValue(dis, attrs);
} else if (len > 0) {
if (dis.getIncludeBulkData() == IncludeBulkData.URI
&& dis.isBulkData(attrs)) {
writeBulkData(dis.createBulkData());
} else {
byte[] b = dis.readValue();
if (tag == Tag.TransferSyntaxUID
|| tag == Tag.SpecificCharacterSet)
attrs.setBytes(tag, vr, b);
if (vr.isInlineBinary())
writeInlineBinary(dis.bigEndian()
? vr.toggleEndian(b, false)
: b);
else
writeValues(vr, b, dis.bigEndian(),
attrs.getSpecificCharacterSet(vr));
}