/**
  * 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;
 }
示例#2
0
 private void loadCommentTemplates() {
   IPath pluginStateLocation =
       CVSUIPlugin.getPlugin().getStateLocation().append(COMMENT_TEMPLATES_FILE);
   File file = pluginStateLocation.toFile();
   if (!file.exists()) return;
   try {
     BufferedInputStream is = new BufferedInputStream(new FileInputStream(file));
     try {
       readCommentTemplates(is);
     } finally {
       is.close();
     }
   } catch (IOException e) {
     CVSUIPlugin.log(IStatus.ERROR, CVSUIMessages.RepositoryManager_ioException, e);
   } catch (TeamException e) {
     CVSUIPlugin.log(e);
   }
 }
示例#3
0
 private void loadState() {
   IPath pluginStateLocation =
       CVSUIPlugin.getPlugin().getStateLocation().append(REPOSITORIES_VIEW_FILE);
   File file = pluginStateLocation.toFile();
   if (file.exists()) {
     try {
       BufferedInputStream is = new BufferedInputStream(new FileInputStream(file));
       try {
         readState(is);
       } finally {
         is.close();
       }
     } catch (IOException e) {
       CVSUIPlugin.log(IStatus.ERROR, CVSUIMessages.RepositoryManager_ioException, e);
     } catch (TeamException e) {
       CVSUIPlugin.log(e);
     }
   } else {
     IPath oldPluginStateLocation = CVSUIPlugin.getPlugin().getStateLocation().append(STATE_FILE);
     file = oldPluginStateLocation.toFile();
     if (file.exists()) {
       try {
         DataInputStream dis = new DataInputStream(new FileInputStream(file));
         try {
           readOldState(dis);
         } finally {
           dis.close();
         }
         saveState();
         file.delete();
       } catch (IOException e) {
         CVSUIPlugin.log(IStatus.ERROR, CVSUIMessages.RepositoryManager_ioException, e);
       } catch (TeamException e) {
         CVSUIPlugin.log(e);
       }
     }
   }
 }