Retrieves a data stream for a path specification.

    Args:
      path_spec (PathSpec): a path specification.

    Returns:
      DataStream: a data stream or None if not available.
14628
def GetDataStreamByPathSpec(self, path_spec):
    
    file_entry = self.GetFileEntryByPathSpec(path_spec)
    if not file_entry:
      return None

    data_stream_name = getattr(path_spec, 'data_stream', None)
    return file_entry.GetDataStream(data_stream_name)
513272
def _addSpecfile(self, specfile, path):
        
        datatypeStatus = {'rm': False, 'ci': False, 'smi': False, 'sai': False,
                          'si': False
                          }
        self.info[specfile] = {'path': path, 'status': datatypeStatus}
240573
def get_data_path(data, module, check_exists=True):
    
    basepath = os.path.dirname(os.path.abspath(inspect.getfile(module)))

    if isinstance(data, basestring):
        data = [data]

    dirpath = os.path.join(basepath, *data)

    if check_exists:
        assert os.path.exists(dirpath), '{0} does not exist'.format(dirpath)

    return pathlib.Path(dirpath)
260464
public static String pathInfo(String pathSpec, String path)
    {
        char c = pathSpec.charAt(0);
        
        if (c=='/')
        {
            if (pathSpec.length()==1)
                return null;
            
            if (pathSpec.equals(path))
                return null;
            
            if (pathSpec.endsWith("/*") &&
                pathSpec.regionMatches(0,path,0,pathSpec.length()-2))
            {
                if (path.length()==pathSpec.length()-2)
                    return null;
                return path.substring(pathSpec.length()-2);
            }
        } 
        return null;
    }
368960
def _get_specification(self, specification):
        
        result = six.moves.urllib.parse.urlparse(specification)

        # If the specification has an http or an https scheme we can
        # retrieve it via an HTTP get request, else we try to open it
        # as a file.
        if result.scheme in ['http', 'https']:
            response = requests.get(specification)
            spec_json = response.json()
        else:
            with open(specification, 'r') as spec_file:
                spec_json = json.load(spec_file)

        return spec_json
1002736
def get(path,data={},headers=nil)
      data_to_query(data)
      if headers == nil
        response = @http.send_request('GET', path, @defaults[:data])
      else
        response = @http.send_request('GET', path, @defaults[:data], headers)
      end
      response
    end
411724
def get_paths_data(self):
        
        for path, path_spec in self.specification['paths'].items():
            path = u'{0}{1}'.format(self.base_path, path)
            self.paths[path] = {}

            # Add path-level parameters
            default_parameters = {}
            if 'parameters' in path_spec:
                self._add_parameters(default_parameters, path_spec['parameters'])

            for http_method in path_spec.keys():
                if http_method not in self._HTTP_VERBS:
                    continue

                self.paths[path][http_method] = {}

                # Add to operation list
                action = path_spec[http_method]
                tag = action['tags'][0] if 'tags' in action.keys() and action['tags'] else None
                if 'operationId' in action.keys():
                    self.operation[action['operationId']] = (path, http_method, tag)
                else:
                    # Note: the encoding chosen below isn't very important in this
                    #       case; what matters is a byte string that is unique.
                    #       URL paths and http methods should encode to UTF-8 safely.
                    h = hashlib.sha256()
                    h.update(("{0}|{1}".format(http_method, path)).encode('utf-8'))
                    self.generated_operation[h.hexdigest()] = (path, http_method, tag)

                # Get parameters
                self.paths[path][http_method]['parameters'] = default_parameters.copy()
                if 'parameters' in action.keys():
                    self._add_parameters(self.paths[path][http_method]['parameters'], action['parameters'])

                # Get responses
                self.paths[path][http_method]['responses'] = action['responses']

                # Get mime types for this action
                if 'consumes' in action.keys():
                    self.paths[path][http_method]['consumes'] = action['consumes']
440943
def get_datastream(self, datastream):
        
        response = self.http.get('/Datastream/' + str(datastream))
        datastream = Schemas.Datastream(datastream=response)
        return datastream
658832
def _GetDataStreams(self):
    
    if self._data_streams is None:
      if self._directory is None:
        self._directory = self._GetDirectory()

      self._data_streams = []

      # It is assumed that directory and link file entries typically
      # do not have data streams.
      if not self._directory and not self.link:
        data_stream = DataStream()
        self._data_streams.append(data_stream)

    return self._data_streams
1277831
def GetFileEntryByPathSpec(self, path_spec):
    
    return compressed_stream_file_entry.CompressedStreamFileEntry(
        self._resolver_context, self, path_spec, is_root=True, is_virtual=True)
339798
def get(self, path):
        
        mountpoint, chunks = self.get_mountpoint(path)

        if mountpoint is None:
            return self._files.get(self._join_chunks(chunks))
        else:
            return mountpoint.get(chunks)
1093136
public InputStream getResourceAsStream( String path ) {
        Object in = null;
        if ( externalClassLoader != null )
            // classloader wants no leading slash
            in = externalClassLoader.getResourceAsStream( path.substring(1) );
        if ( in == null )
            return Interpreter.class.getResourceAsStream( path );

        return (InputStream) in;
    }
1211211
def GetFileEntryByPathSpec(self, path_spec):
    
    if not self.FileEntryExistsByPathSpec(path_spec):
      return None

    location = getattr(path_spec, 'location', None)

    if len(location) == 1:
      return tar_file_entry.TARFileEntry(
          self._resolver_context, self, path_spec, is_root=True,
          is_virtual=True)

    kwargs = {}
    try:
      kwargs['tar_info'] = self._tar_file.getmember(location[1:])
    except KeyError:
      kwargs['is_virtual'] = True

    return tar_file_entry.TARFileEntry(
        self._resolver_context, self, path_spec, **kwargs)
270969
def GetAPFSVolumeByPathSpec(self, path_spec):
    
    volume_index = apfs_helper.APFSContainerPathSpecGetVolumeIndex(path_spec)
    if volume_index is None:
      return None

    return self._fsapfs_container.get_volume(volume_index)
263943
def GetTSKFileByPathSpec(self, path_spec):
    
    # Opening a file by inode number is faster than opening a file
    # by location.
    inode = getattr(path_spec, 'inode', None)
    location = getattr(path_spec, 'location', None)

    if inode is not None:
      tsk_file = self._tsk_file_system.open_meta(inode=inode)
    elif location is not None:
      tsk_file = self._tsk_file_system.open(location)
    else:
      raise errors.PathSpecError(
          'Path specification missing inode and location.')

    return tsk_file
205495
def VShadowPathSpecGetStoreIndex(path_spec):
  
  store_index = getattr(path_spec, 'store_index', None)

  if store_index is None:
    location = getattr(path_spec, 'location', None)

    if location is None or not location.startswith('/vss'):
      return None

    store_index = None
    try:
      store_index = int(location[4:], 10) - 1
    except (TypeError, ValueError):
      pass

    if store_index is None or store_index < 0:
      return None

  return store_index
391215
def list(self, path):
        
        try:
            payload = {
                'list': True
            }
            return self._adapter.get('/v1/{0}'.format(path), params=payload).json()
        except exceptions.InvalidPath:
            return None