Open the media player to play the given media

@param path The file path of the media to play.
@param type The mime type
@return the intent
160970
public static Intent newPlayMediaFileIntent(String path, String type) {
        return newPlayMediaIntent(Uri.fromFile(new File(path)), type);
    }
82456
public function open($path, $type = null, $password = null)
    {
        if (null === $type) {
            $type = $this->guessAdapterExtension($path);
        }

        try {
            $adapter = $this->getAdapterFor($this->sanitizeExtension($type));
            if (method_exists($adapter, 'setPassword') && $password){
                $adapter->setPassword($password);
            }
            return $adapter->open($path);
        } catch (ExceptionInterface $e) {
            throw new RuntimeException('Unable to open archive', $e->getCode(), $e);
        }
    }
1272278
def update_media(media_uri, file_path, content_type)
      file_path = Pathname.new(file_path) unless file_path.is_a?(Pathname)
      stream = file_path.open { |f| f.binmode; f.read }
      update_resource(media_uri, stream, content_type)
    end
1069134
public static <T> T readObjectFromFile(String path, Class<T> type, SparkContext sc) throws IOException {
        FileSystem fileSystem = FileSystem.get(sc.hadoopConfiguration());
        try (ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(fileSystem.open(new Path(path))))) {
            Object o;
            try {
                o = ois.readObject();
            } catch (ClassNotFoundException e) {
                throw new RuntimeException(e);
            }

            return (T) o;
        }
    }
865583
public static Image load(String path)
  {
    BufferedImage image = null;

    try
    {
      InputStream in = ImageUtils.class.getClassLoader().getResourceAsStream(path);
      image = ImageIO.read(in);
      in.close();
    }
    catch (Exception e)
    {
      throw new RuntimeException("Could not load image with path: " + path, e);
    }

    return image;

  }
1028393
protected function getContentOfType(string $path, int $type): ?vfsStreamContent
    {
        $content = $this->getContent($path);
        if (null !== $content && $content->getType() === $type) {
            return $content;
        }

        return null;
    }
446447
private void openItemsOnPath(String path) {

        List<CmsSitemapTreeItem> itemsOnPath = getItemsOnPath(path);
        for (CmsSitemapTreeItem item : itemsOnPath) {
            item.setOpen(true);
        }
    }
1121960
public static InputStream newInputStream(String path) throws IOException
    {
        if (IOAdapter == null) return new FileInputStream(path);
        return IOAdapter.open(path);
    }
371404
function mimeType( path ) {
	var extension = path.replace( /.*[./\\]/ , '' ).toLowerCase() ;

	if ( ! mimeType.extension[ extension ] ) {
		// default MIME type, when nothing is found
		return 'application/octet-stream' ;
	}

	return mimeType.extension[ extension ] ;
}
169952
public Resource addPath(String path)
        throws IOException,MalformedURLException
    {
        FileResource r=null;

        if (!isDirectory())
        {
            r=(FileResource)super.addPath(path);
        }
        else
        {
            path = org.browsermob.proxy.jetty.util.URI.canonicalPath(path);
            
            // treat all paths being added as relative
            String rel=path;
            if (path.startsWith("/"))
                rel = path.substring(1);
            
            File newFile = new File(_file,rel.replace('/', File.separatorChar));
            r=new FileResource(newFile.toURI().toURL(),null,newFile);
        }
        
        String encoded= org.browsermob.proxy.jetty.util.URI.encodePath(path);
        int expected=r._urlString.length()-encoded.length();
        int index = r._urlString.lastIndexOf(encoded, expected);
        
        if (expected!=index && ((expected-1)!=index || path.endsWith("/") || !r.isDirectory()))
        {
            r._alias=r._url;
            r._aliasChecked=true;
        }                   
        return r;
    }
304081
public static function getFileMime($path, $type = self::MIME_FINFO)
    {
        switch ($type) {
            case self::MIME_CMD:
                $mime = self::getFileMimeByCmd($path);
                break;
            default:
                $mime = self::getFileMimeByFinfo($path);
                break;
        }
        return $mime;
    }
1101722
private FSDirectory openLuceneDirectory(final File path) {
      try {
         return FSDirectory.open(path.toPath());
      }
      catch (IOException e) {
         throw log.exceptionInCacheLoader(e);
      }
   }
511793
public function add_type($type, $path = null)
	{
		isset($this->_asset_paths[$type]) or $this->_asset_paths[$type] = array();
		isset($this->_path_folders[$type]) or $this->_path_folders[$type] = $type.'/';

		if ( ! is_null($path))
		{
			$path = $this->_unify_path($path);
			$this->_asset_paths[$type][] = $path;
		}

		return $this;
	}
952116
public void openPath(String path, I_CmsOuTreeType type, CmsUUID groupID) {

        if (type == null) {
            return;
        }
        try {
            expandItem(m_rootOu);
            String[] pathP = path.split("/");
            String complPath = "";
            for (String subP : pathP) {
                complPath += subP + "/";
                CmsOrganizationalUnit ou = OpenCms.getOrgUnitManager().readOrganizationalUnit(m_cms, complPath);
                addChildrenForOUNode(ou);
                expandItem(ou);
            }

            if (type.isGroup() || type.isRole()) {
                String itemId = type.getId()
                    + OpenCms.getOrgUnitManager().readOrganizationalUnit(m_cms, path).getName();
                expandItem(itemId);
                if (groupID == null) {
                    setValue(itemId);
                    return;
                }
                setValue(groupID);
                return;
            }
            if (type.isUser()) {
                setValue(type.getId() + OpenCms.getOrgUnitManager().readOrganizationalUnit(m_cms, path).getName());
                return;
            }

            setValue(OpenCms.getOrgUnitManager().readOrganizationalUnit(m_cms, path));

        } catch (CmsException e) {
            LOG.error("Unable to read OU", e);
        }
    }
1154611
protected InputStream getInputStream (String path)
        throws IOException
    {
        FileInputStream fis = new FileInputStream(path);
        return new BufferedInputStream(fis);
    }
1115120
public function upload(string $type, string $path): array
    {
        return $this->httpClient->postFile('media/upload', $path, compact('type'));
    }
1151187
@SuppressWarnings("unchecked")
    @Override
    public <T> T runScript(String path) throws IOException {
        List<URL> urls = Paths.toURLs(path);
        Object result = null;
        for (URL url : urls) {
            try (Reader reader = new BufferedReader(new InputStreamReader(url.openStream()))) {
                result = runScript(reader, url.getPath());
            }
        }
        return (T) result;
    }