public void writeAttribute(int tag, VR vr, Object value, SpecificCharacterSet cs) throws IOException { if (value instanceof Value) writeAttribute(tag, vr, (Value) value); else writeAttribute(tag, vr, (value instanceof byte[]) ? (byte[]) value : vr.toBytes(value, cs)); }
public byte[] getBytes(String privateCreator, int tag) throws IOException { int index = indexOf(privateCreator, tag); if (index < 0) return null; Object value = values[index]; VR vr = vrs[index]; try { if (value instanceof Value) return ((Value) value).toBytes(vr, bigEndian); return vr.toBytes(value, getSpecificCharacterSet(vr)); } catch (UnsupportedOperationException e) { LOG.info("Attempt to access {} {} as bytes", TagUtils.toString(tag), vr); return null; } }
else { if (!(val instanceof byte[])) values[i] = val = vr.toBytes(val, cs); len += (((byte[]) val).length + 1) & ~1;