Ejemplo n.º 1
0
    def testRead(self):
        """Test the read functionality."""
        file_object = compressed_stream_io.CompressedStream(
            self._resolver_context)
        file_object.open(path_spec=self._compressed_stream_path_spec)

        self._TestReadFileObject(file_object)

        file_object.close()
Ejemplo n.º 2
0
    def testOpenClosePathSpec(self):
        """Test the open and close functionality using a path specification."""
        file_object = compressed_stream_io.CompressedStream(
            self._resolver_context)
        file_object.open(path_spec=self._compressed_stream_path_spec)

        self._TestGetSizeFileObject(file_object)

        file_object.close()
    def NewFileObject(self, resolver_context):
        """Creates a new file-like object.

    Args:
      resolver_context (Context): resolver context.

    Returns:
      FileIO: file-like object.
    """
        return compressed_stream_io.CompressedStream(resolver_context)
    def NewFileObject(self, resolver_context, path_spec):
        """Creates a new file input/output (IO) object.

    Args:
      resolver_context (Context): resolver context.
      path_spec (PathSpec): a path specification.

    Returns:
      FileIO: file input/output (IO) object.
    """
        return compressed_stream_io.CompressedStream(resolver_context,
                                                     path_spec)
Ejemplo n.º 5
0
    def testOpenCloseFileObject(self):
        """Test the open and close functionality using a file-like object."""
        os_file_object = os_file_io.OSFile(self._resolver_context)
        os_file_object.open(path_spec=self._os_path_spec)
        file_object = compressed_stream_io.CompressedStream(
            self._resolver_context,
            compression_method=definitions.COMPRESSION_METHOD_LZMA,
            file_object=os_file_object)
        file_object.open()

        self._TestGetSizeFileObject(file_object)

        file_object.close()
        os_file_object.close()