private static InputStream detect(InputStream input) throws IOException { BufferedInputStream reader = new BufferedInputStream(input, 1024 * 1024); reader.mark(1000); try { return new GZIPInputStream(reader); } catch (Exception e) {; } reader.reset(); return reader; }
/** * Given a DICOM object encoded as an XML document in a named file convert it to a list of * attributes. * * @param name the input file containing the XML document * @return the list of DICOM attributes * @exception IOException * @exception SAXException * @exception DicomException */ public AttributeList getAttributeList(String name) throws IOException, SAXException, DicomException { InputStream fi = new FileInputStream(name); BufferedInputStream bi = new BufferedInputStream(fi); AttributeList list = null; try { list = getAttributeList(bi); } finally { bi.close(); fi.close(); } return list; }