Populates a Map instance representing the IDs and names of
projects available in the current file.

@param is input stream used to read XER file
@return Map instance containing ID and name pairs
@throws MPXJException
761151
public Map<Integer, String> listProjects(InputStream is) throws MPXJException
   {
      try
      {
         m_tables = new HashMap<String, List<Row>>();
         processFile(is);

         Map<Integer, String> result = new HashMap<Integer, String>();

         List<Row> rows = getRows("project", null, null);
         for (Row row : rows)
         {
            Integer id = row.getInteger("proj_id");
            String name = row.getString("proj_short_name");
            result.put(id, name);
         }

         return result;
      }

      finally
      {
         m_tables = null;
         m_currentTable = null;
         m_currentFieldNames = null;
      }
   }
1349030
public List<XLog> parse(InputStream is) throws Exception {
		BufferedInputStream bis = new BufferedInputStream(is);
		// set up a specialized SAX2 handler to fill the container
		XesXmlHandler handler = new XesXmlHandler();
		// set up SAX parser and parse provided log file into the container
		SAXParserFactory parserFactory = SAXParserFactory.newInstance();
		parserFactory.setNamespaceAware(false);
		SAXParser parser = parserFactory.newSAXParser();
		parser.parse(bis, handler);
		bis.close();
		ArrayList<XLog> wrapper = new ArrayList<XLog>();
		wrapper.add(handler.getLog());
		return wrapper;
	}
379008
public static Map<String, IDLProxyObject> create(InputStream is, boolean debug) throws IOException {
        return create(is, debug, null, true);
    }
1048111
public ProjectCalendar addResourceCalendar() throws MPXJException
   {
      if (getResourceCalendar() != null)
      {
         throw new MPXJException(MPXJException.MAXIMUM_RECORDS);
      }

      ProjectCalendar calendar = new ProjectCalendar(getParentFile());
      setResourceCalendar(calendar);
      return calendar;
   }
780309
private void processProjectProperties() throws MPXJException
   {
      ProjectPropertiesReader reader = new ProjectPropertiesReader();
      reader.process(m_file, m_projectProps, m_root);
   }
1344745
public static Map<String, IDLProxyObject> create(InputStream is, boolean debug, File path) throws IOException {
        return create(is, debug, path, true);

    }
1075868
def _readXputMaps(self, mapCards, directory, session, spatial=False, spatialReferenceID=4236, replaceParamFile=None):
        
        if self.mapType in self.MAP_TYPES_SUPPORTED:
            for card in self.projectCards:
                if (card.name in mapCards) and self._noneOrNumValue(card.value):
                    filename = card.value.strip('"')

                    # Invoke read method on each map
                    self._invokeRead(fileIO=RasterMapFile,
                                     directory=directory,
                                     filename=filename,
                                     session=session,
                                     spatial=spatial,
                                     spatialReferenceID=spatialReferenceID,
                                     replaceParamFile=replaceParamFile)
        else:
            for card in self.projectCards:
                if (card.name in mapCards) and self._noneOrNumValue(card.value):
                    filename = card.value.strip('"')
                    fileExtension = filename.split('.')[1]
                    if fileExtension in self.ALWAYS_READ_AND_WRITE_MAPS:
                        # Invoke read method on each map
                        self._invokeRead(fileIO=RasterMapFile,
                                         directory=directory,
                                         filename=filename,
                                         session=session,
                                         spatial=spatial,
                                         spatialReferenceID=spatialReferenceID,
                                         replaceParamFile=replaceParamFile)

            log.warning('Could not read map files. '
                     'MAP_TYPE {0} not supported.'.format(self.mapType))
639899
private static PBXObjectRef createPBXProject(final PBXObjectRef buildConfigurationList, final PBXObjectRef mainGroup,
      final String projectDirPath, final String projectRoot, final List targets) {
    final Map map = new HashMap();
    map.put("isa", "PBXProject");
    map.put("buildConfigurationList", buildConfigurationList.getID());
    map.put("hasScannedForEncodings", "0");
    map.put("mainGroup", mainGroup.getID());
    map.put("projectDirPath", projectDirPath);
    map.put("targets", targets);
    map.put("projectRoot", projectRoot);
    return new PBXObjectRef(map);
  }
130301
public static Map<String, IDLProxyObject> create(File file) throws IOException {
        return create(file, false);
    }
449138
private SoyMap newSoyMapFromJavaMap(Map<?, ?> javaMap) {
    Map<SoyValue, SoyValueProvider> map = Maps.newHashMapWithExpectedSize(javaMap.size());
    for (Map.Entry<?, ?> entry : javaMap.entrySet()) {
      map.put(convert(entry.getKey()).resolve(), convertLazy(entry.getValue()));
    }
    return SoyMapImpl.forProviderMap(map);
  }
130501
private void populateMemberData(MPPReader reader, ProjectFile file, DirectoryEntry root) throws MPXJException, IOException
   {
      m_reader = reader;
      m_file = file;
      m_eventManager = file.getEventManager();
      m_root = root;

      //
      // Retrieve the high level document properties (never encoded)
      //
      Props9 props9 = new Props9(new DocumentInputStream(((DocumentEntry) root.getEntry("Props9"))));
      //System.out.println(props9);

      file.getProjectProperties().setProjectFilePath(props9.getUnicodeString(Props.PROJECT_FILE_PATH));
      m_inputStreamFactory = new DocumentInputStreamFactory(props9);

      //
      // Test for password protection. In the single byte retrieved here:
      //
      // 0x00 = no password
      // 0x01 = protection password has been supplied
      // 0x02 = write reservation password has been supplied
      // 0x03 = both passwords have been supplied
      //
      if ((props9.getByte(Props.PASSWORD_FLAG) & 0x01) != 0)
      {
         // File is password protected for reading, let's read the password
         // and see if the correct read password was given to us.
         String readPassword = MPPUtility.decodePassword(props9.getByteArray(Props.PROTECTION_PASSWORD_HASH), m_inputStreamFactory.getEncryptionCode());
         // It looks like it is possible for a project file to have the password protection flag on without a password. In
         // this case MS Project treats the file as NOT protected. We need to do the same. It is worth noting that MS Project does
         // correct the problem if the file is re-saved (at least it did for me).
         if (readPassword != null && readPassword.length() > 0)
         {
            // See if the correct read password was given
            if (reader.getReadPassword() == null || reader.getReadPassword().matches(readPassword) == false)
            {
               // Passwords don't match
               throw new MPXJException(MPXJException.PASSWORD_PROTECTED_ENTER_PASSWORD);
            }
         }
         // Passwords matched so let's allow the reading to continue.
      }

      m_resourceMap = new HashMap<Integer, ProjectCalendar>();
      m_projectDir = (DirectoryEntry) root.getEntry("   19");
      m_viewDir = (DirectoryEntry) root.getEntry("   29");
      DirectoryEntry outlineCodeDir = (DirectoryEntry) m_projectDir.getEntry("TBkndOutlCode");
      VarMeta outlineCodeVarMeta = new VarMeta9(new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("VarMeta"))));
      m_outlineCodeVarData = new Var2Data(outlineCodeVarMeta, new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("Var2Data"))));
      m_projectProps = new Props9(m_inputStreamFactory.getInstance(m_projectDir, "Props"));
      //MPPUtility.fileDump("c:\\temp\\props.txt", m_projectProps.toString().getBytes());

      m_fontBases = new HashMap<Integer, FontBase>();
      m_taskSubProjects = new HashMap<Integer, SubProject>();

      m_file.getProjectProperties().setMppFileType(Integer.valueOf(9));
      m_file.getProjectProperties().setAutoFilter(props9.getBoolean(Props.AUTO_FILTER));
   }
96048
public static Collection map(Mapper mapper, Iterator i) {
        return map(mapper, i, false);
    }
450049
public ProjectFile read() throws MPXJException
   {
      try
      {
         m_reader = new AstaReader();
         ProjectFile project = m_reader.getProject();
         project.getEventManager().addProjectListeners(m_projectListeners);

         processProjectProperties();
         processCalendars();
         processResources();
         processTasks();
         processPredecessors();
         processAssignments();

         m_reader = null;

         return (project);
      }

      catch (SQLException ex)
      {
         throw new MPXJException(MPXJException.READ_ERROR, ex);
      }

      finally
      {
         if (m_allocatedConnection && m_connection != null)
         {
            try
            {
               m_connection.close();
            }

            catch (SQLException ex)
            {
               // silently ignore errors on close
            }

            m_connection = null;
         }
      }
   }
718538
public List<ProjectFile> readAll() throws MPXJException
   {
      Map<Integer, String> projects = listProjects();
      List<ProjectFile> result = new ArrayList<ProjectFile>(projects.keySet().size());
      for (Integer id : projects.keySet())
      {
         setProjectID(id.intValue());
         result.add(read());
      }
      return result;
   }
21433
private void process(String input, String output) throws MPXJException, IOException
   {
      //
      // Extract the project data
      //
      MPPReader reader = new MPPReader();
      m_project = reader.read(input);

      String varDataFileName;
      String projectDirName;
      int mppFileType = NumberHelper.getInt(m_project.getProjectProperties().getMppFileType());
      switch (mppFileType)
      {
         case 8:
         {
            projectDirName = "   1";
            varDataFileName = "FixDeferFix   0";
            break;
         }

         case 9:
         {
            projectDirName = "   19";
            varDataFileName = "Var2Data";
            break;
         }

         case 12:
         {
            projectDirName = "   112";
            varDataFileName = "Var2Data";
            break;
         }

         case 14:
         {
            projectDirName = "   114";
            varDataFileName = "Var2Data";
            break;
         }

         default:
         {
            throw new IllegalArgumentException("Unsupported file type " + mppFileType);
         }
      }

      //
      // Load the raw file
      //
      FileInputStream is = new FileInputStream(input);
      POIFSFileSystem fs = new POIFSFileSystem(is);
      is.close();

      //
      // Locate the root of the project file system
      //
      DirectoryEntry root = fs.getRoot();
      m_projectDir = (DirectoryEntry) root.getEntry(projectDirName);

      //
      // Process Tasks
      //
      Map<String, String> replacements = new HashMap<String, String>();
      for (Task task : m_project.getTasks())
      {
         mapText(task.getName(), replacements);
      }
      processReplacements(((DirectoryEntry) m_projectDir.getEntry("TBkndTask")), varDataFileName, replacements, true);

      //
      // Process Resources
      //
      replacements.clear();
      for (Resource resource : m_project.getResources())
      {
         mapText(resource.getName(), replacements);
         mapText(resource.getInitials(), replacements);
      }
      processReplacements((DirectoryEntry) m_projectDir.getEntry("TBkndRsc"), varDataFileName, replacements, true);

      //
      // Process project properties
      //
      replacements.clear();
      ProjectProperties properties = m_project.getProjectProperties();
      mapText(properties.getProjectTitle(), replacements);
      processReplacements(m_projectDir, "Props", replacements, true);

      replacements.clear();
      mapText(properties.getProjectTitle(), replacements);
      mapText(properties.getSubject(), replacements);
      mapText(properties.getAuthor(), replacements);
      mapText(properties.getKeywords(), replacements);
      mapText(properties.getComments(), replacements);
      processReplacements(root, "\005SummaryInformation", replacements, false);

      replacements.clear();
      mapText(properties.getManager(), replacements);
      mapText(properties.getCompany(), replacements);
      mapText(properties.getCategory(), replacements);
      processReplacements(root, "\005DocumentSummaryInformation", replacements, false);

      //
      // Write the replacement raw file
      //
      FileOutputStream os = new FileOutputStream(output);
      fs.writeFilesystem(os);
      os.flush();
      os.close();
      fs.close();
   }
363010
public static XPathUtils newXPath(final InputStream is)
            throws SAXException, IOException {
        final XPathFactory xpfactory = XPathFactory.newInstance();
        final XPath xPath = xpfactory.newXPath();
        final Document doc = XmlUtils.toDoc(is);
        return new XPathUtils(xPath, doc);
    }
852258
public static Map<String, IDLProxyObject> create(InputStream is, boolean debug, File path, boolean isUniName)
            throws IOException {
        ProtoFile protoFile = ProtoSchemaParser.parseUtf8(DEFAULT_FILE_NAME, is);
        List<CodeDependent> cds = new ArrayList<CodeDependent>();
        return doCreate(protoFile, true, debug, path, false, null, cds, new HashMap<String, String>(), isUniName);
    }