Creates a reader for the xml file.

@param archivePath
path to the xml file
@return InputStreamReader
484610
private static InputStreamReader readXMLFile(final String archivePath)
	{

		try {
			return new InputStreamReader(new BufferedInputStream(new FileInputStream(archivePath)),
					WIKIPEDIA_ENCODING);

		}
		catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
386757
public InputStreamReader getFileStream(String filename)
			throws NoSuchPathException{
		try {
			return new InputStreamReader(new FileInputStream(filename));
		} catch (FileNotFoundException e) {
			throw new NoSuchPathException(e);
		}
	}
1020844
public static InputStream fromFile(String filepath) throws FileNotFoundException {
		if(Strings.isValid(filepath)) {
			return fromFile(new File(filepath));
		}
		return null;
	}
686625
public @CheckForNull FilePath createPath(String absolutePath) {
        VirtualChannel ch = getChannel();
        if(ch==null)    return null;    // offline
        return new FilePath(ch,absolutePath);
    }
1336555
public static ClassFileReader newInstance(Path path, JarFile jf) throws IOException {
        return new JarFileReader(path, jf);
    }
982044
public static String readFile(String filePath, TestContext context) {
        return new ReadFileResourceFunction().execute(Collections.singletonList(filePath), context);
    }
709109
public Reader create(InputStream is, String javaEncoding)
    throws UnsupportedEncodingException
  {
    if (Charset.isSupported(javaEncoding)) {
      Charset charset = Charset.forName(javaEncoding);
    
      return new InputStreamReader(is, charset);
    }
    else {
      // RSN-274, Charset doesn't support all java.io encoding
      return new InputStreamReader(is, javaEncoding);
    }
  }
395654
@Deprecated
	public static <T> T load(ReaderHandler<T> readerHandler, String path, String charset) throws IORuntimeException {
		return FileReader.create(file(path), CharsetUtil.charset(charset)).read(readerHandler);
	}
1048349
public InputStreamReader getDecompressionStream(String path, String encoding)
		throws IOException
	{
		File fileToUncompress = new File(path);

		BufferedInputStream fileStream = new BufferedInputStream(new FileInputStream(fileToUncompress));

		// read bzip2 prefix: BZ
		fileStream.read();
		fileStream.read();

		BufferedInputStream bufferedStream = new BufferedInputStream(fileStream);

		CBZip2InputStream input = new CBZip2InputStream(bufferedStream);

		return new InputStreamReader(input, encoding);

	}
610776
public static BufferedReader getReader(String path, Charset charset) throws IORuntimeException {
		return getReader(file(path), charset);
	}
439929
public Reader create(InputStream is)
    throws UnsupportedEncodingException
  {
    Reader reader = create(is, getJavaEncoding());

    if (reader != null)
      return reader;
    else
      return new ISO8859_1Reader(is);
  }
754000
private static InputStream getStreamFromClasspath(String fileName)
    {
        String path = fileName;
        InputStream dtdStream = PersistenceXMLLoader.class.getClassLoader().getResourceAsStream(path);
        return dtdStream;
    }
495601
@Override
    public <X extends Archive<X>> X getAsType(Class<X> type, String path) {
        Validate.notNull(path, "Path must be specified");
        return getAsType(type, ArchivePaths.create(path));
    }
843583
public static ClassFileReader newInstance(Path path, Runtime.Version version) throws IOException {
        if (Files.notExists(path)) {
            throw new FileNotFoundException(path.toString());
        }

        if (Files.isDirectory(path)) {
            return new DirectoryReader(path);
        } else if (path.getFileName().toString().endsWith(".jar")) {
            return new JarFileReader(path, version);
        } else {
            return new ClassFileReader(path);
        }
    }
475539
public static function getReader($filePath)
    {
        $xmlReader = new \SimpleXMLElement($filePath, null, true);
        
        switch ($xmlReader->attributes()->version) {
            case '1.1.0':
                return new MzIdentMlReader1r1($filePath);
            case '1.2.0':
                return new MzIdentMlReader1r2($filePath);
            default:
                throw new \UnexpectedValueException('Version ' . $xmlReader->attributes()->version . ' is not supported');
        }
    }
369710
public static Node read(InputStream inputStream) throws XmlException
    {
        try
        {
            DocumentBuilderFactory documentBuilderFactory = 
                DocumentBuilderFactory.newInstance();
            DocumentBuilder documentBuilder = 
                documentBuilderFactory.newDocumentBuilder();
            Document document = documentBuilder.parse(inputStream);
            Node node = document.getDocumentElement();
            return node;
        } 
        catch (ParserConfigurationException canNotHappen)
        {
            // Can not happen with a default configuration
            throw new XmlException("Could not create parser", canNotHappen);
        } 
        catch (SAXException e)
        {
            throw new XmlException("XML parsing error", e);
        }
        catch (IOException e)
        {
            throw new XmlException("IO error while reading XML", e);
        }

    }
105643
@Override
    public XMLStreamReader2 createXMLStreamReader(File f)
        throws XMLStreamException
    {
        /* true for auto-close, since caller has no access to the underlying
         * input stream created from the File
         */
        return createSR(f, false, true);
    }