package ua.stu.scplib.attribute; import java.io.*; /** * <p>A concrete class specializing {@link com.pixelmed.dicom.Attribute Attribute} for * Unknown (UN) attributes.</p> * * <p>Though an instance of this class may be created * using its constructors, there is also a factory class, {@link com.pixelmed.dicom.AttributeFactory AttributeFactory}.</p> * * @see com.pixelmed.dicom.Attribute * @see com.pixelmed.dicom.AttributeFactory * @see com.pixelmed.dicom.AttributeList * * @author dclunie */ public class UnknownAttribute extends Attribute { /** * <p>Construct an (empty) attribute.</p> * * @param t the tag of the attribute */ public UnknownAttribute(AttributeTag t) { super(t); } /** * <p>Read an attribute from an input stream.</p> * * @param t the tag of the attribute * @param vl the value length of the attribute * @param i the input stream * @exception IOException * @exception DicomException */ public UnknownAttribute(AttributeTag t,long vl,DicomInputStream i) throws IOException, DicomException { super(t); doCommonConstructorStuff(vl,i); } /** * <p>Read an attribute from an input stream.</p> * * @param t the tag of the attribute * @param vl the value length of the attribute * @param i the input stream * @exception IOException * @exception DicomException */ public UnknownAttribute(AttributeTag t,Long vl,DicomInputStream i) throws IOException, DicomException { super(t); doCommonConstructorStuff(vl.longValue(),i); } /** * @param vl * @param i * @exception IOException * @exception DicomException */ private void doCommonConstructorStuff(long vl,DicomInputStream i) throws IOException, DicomException { valueLength=vl; valueMultiplicity=1; try { i.skipInsistently(vl); } catch (IOException e) { throw new DicomException("Failed to skip value (length "+vl+" dec) in UN attribute "+getTag()); } } /***/ public String toString(DicomDictionary dictionary) { return super.toString(dictionary)+" "+getVR()+" "; } /** * <p>Get the value representation of this attribute (UN).</p> * * @return 'U','U' in ASCII as a two byte array; see {@link com.pixelmed.dicom.ValueRepresentation ValueRepresentation} */ public byte[] getVR() { return ValueRepresentation.UN; } }