Retrieves a ProjectReader instance which can read a file of the
type specified by the supplied file name.

@param name file name
@return ProjectReader instance
482446
public static ProjectReader getProjectReader(String name) throws MPXJException
   {
      int index = name.lastIndexOf('.');
      if (index == -1)
      {
         throw new IllegalArgumentException("Filename has no extension: " + name);
      }

      String extension = name.substring(index + 1).toUpperCase();

      Class<? extends ProjectReader> fileClass = READER_MAP.get(extension);
      if (fileClass == null)
      {
         throw new IllegalArgumentException("Cannot read files of type: " + extension);
      }

      try
      {
         ProjectReader file = fileClass.newInstance();
         return (file);
      }

      catch (Exception ex)
      {
         throw new MPXJException("Failed to load project reader", ex);
      }
   }
983887
public Project getProject(final String name) {
    Project fetchedProject = this.projectsByName.get(name);
    if (fetchedProject == null) {
      try {
        fetchedProject = this.projectLoader.fetchProjectByName(name);
        if (fetchedProject != null) {
          logger.info("Project " + name + " not found in cache, fetched from DB.");
        } else {
          logger.info("No active project with name " + name + " exists in cache or DB.");
        }
      } catch (final ProjectManagerException e) {
        logger.error("Could not load project from store.", e);
      }
    }
    return fetchedProject;
  }
58759
public static BufferedReader asBufferedReader(String fileName) throws IOException {
		Validate.notBlank(fileName, "filename is blank");
		return asBufferedReader(getPath(fileName));
	}
691939
public static String readFile(String fileName) throws IOException {
        logger.entering(fileName);
        Preconditions.checkArgument(StringUtils.isNotBlank(fileName), "File name cannot be null (or) empty.");
        StringBuilder output = new StringBuilder();
        try (BufferedReader buffreader = new BufferedReader(new InputStreamReader(loadFile(fileName),
                Charset.forName("UTF-8")))) {
            String line = null;
            while ((line = buffreader.readLine()) != null) {
                output.append(line);
            }
        }
        logger.exiting(output);
        return output.toString();
    }
1192792
public static byte[] readFileAtOnce(final String filename) throws IOException {
		final FileInputStream fIn = new FileInputStream(filename);
		return readFileAtOnce(fIn);
	}
202696
public InputStream getResourceAsStream(String name)
  {
    Source path;

    path = getPath(name);

    if (path != null && path.canRead()) {
      try {
        return path.inputStream();
      } catch (Exception e) {
      }
    }

    return null;
  }
783799
public ProjectFile read() throws MPXJException
   {
      MPD9DatabaseReader reader = new MPD9DatabaseReader();
      reader.setProjectID(m_projectID);
      reader.setPreserveNoteFormatting(m_preserveNoteFormatting);
      reader.setDataSource(m_dataSource);
      reader.setConnection(m_connection);
      ProjectFile project = reader.read();
      return (project);
   }
1356071
public static Reader getResourceAsReader(ClassLoader loader, String resource) throws IOException {
        return new InputStreamReader(getResourceAsStream(loader, resource));
    }
351137
public static Reader newReader(File file)
            throws IOException
    {
        final String fileEncoding = System.getProperty( "file.encoding", "UTF-8" );
        final String greenPepperEncoding = System.getProperty( "greenpepper.file.encoding", fileEncoding );
        return newReader( file, greenPepperEncoding );
    }
1191401
public static final ProjectFile setProjectNameAndRead(File directory) throws MPXJException
   {
      List<String> projects = listProjectNames(directory);

      if (!projects.isEmpty())
      {
         P3DatabaseReader reader = new P3DatabaseReader();
         reader.setProjectName(projects.get(0));
         return reader.read(directory);
      }

      return null;
   }
446155
public FrameworkProject getFrameworkProject(final String name) {
        FrameworkProject frameworkProject = loadChild(name);
        if (null != frameworkProject) {
            return frameworkProject;
        }
        throw new NoSuchResourceException("Project does not exist: " + name, this);
    }
1104516
public static String readTextFile(String fileName) {		
		try {
			return readText(new FileInputStream(new File(fileName)));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
			
			return null;
		}
	}
556855
private String readFile(String fileName) {
        String text;
        try {
            try (Reader r = new FileReader(fileName)) {
                text = Kit.readReader(r);
            }
        } catch (IOException ex) {
            MessageDialogWrapper.showMessageDialog(this,
                                                   ex.getMessage(),
                                                   "Error reading "+fileName,
                                                   JOptionPane.ERROR_MESSAGE);
            text = null;
        }
        return text;
    }
1077928
public CharSequence readSource(JavaFileObject filename) {
        try {
            inputFiles.add(filename);
            return filename.getCharContent(false);
        } catch (IOException e) {
            log.error("error.reading.file", filename, JavacFileManager.getMessage(e));
            return null;
        }
    }
1057701
public static String readFile( File file ) throws IOException {
        if (!file.exists()) {
            throw new FileNotFoundException("The required projection file is not available: " + file.getAbsolutePath());
        }
        try (BufferedReader br = new BufferedReader(new FileReader(file))) {
            StringBuilder sb = new StringBuilder(200);
            String line;
            while( (line = br.readLine()) != null ) {
                sb.append(line);
                sb.append("\n"); //$NON-NLS-1$
            }
            return sb.toString();
        }
    }
1060335
public static ProjectWriter getProjectWriter(String name) throws InstantiationException, IllegalAccessException
   {
      int index = name.lastIndexOf('.');
      if (index == -1)
      {
         throw new IllegalArgumentException("Filename has no extension: " + name);
      }

      String extension = name.substring(index + 1).toUpperCase();

      Class<? extends ProjectWriter> fileClass = WRITER_MAP.get(extension);
      if (fileClass == null)
      {
         throw new IllegalArgumentException("Cannot write files of type: " + name);
      }

      ProjectWriter file = fileClass.newInstance();

      return (file);
   }
827243
public String read(String filename) throws IOException {
    Path p = new Path(filename);
    int size = (int) getMfs().getFileStatus(p).getLen();
    FSDataInputStream is = getMfs().open(p);
    byte[] content = new byte[size];
    is.readFully(content);
    return new String(content);
  }