Struct tar::Archive [] [src]

pub struct Archive<R> {
    // some fields omitted
}

A top-level representation of an archive file.

This archive can have a file added to it and it can be iterated over.

Methods

impl<O> Archive<O>
[src]

fn new(obj: O) -> Archive<O>

Create a new archive with the underlying object as the reader/writer.

Different methods are available on an archive depending on the traits that the underlying object implements.

fn into_inner(self) -> O

Unwrap this archive, returning the underlying object.

impl<R: Seek + Read> Archive<R>
[src]

fn files(&self) -> Result<Files<R>>

Construct an iterator over the files of this archive.

This function can return an error if any underlying I/O operation files while attempting to construct the iterator.

Additionally, the iterator yields io::Result<File> instead of File to handle invalid tar archives as well as any intermittent I/O error that occurs.

impl<R: Read> Archive<R>
[src]

fn files_mut(&mut self) -> Result<FilesMut<R>>

Construct an iterator over the files in this archive.

While similar to the files iterator, this iterator does not require that R implement Seek and restricts the iterator to processing only one file at a time in a streaming fashion.

Note that care must be taken to consider each file within an archive in sequence. If files are processed out of sequence (from what the iterator returns), then the contents read for each file may be corrupted.

fn unpack(&mut self, into: &Path) -> Result<()>

Unpacks this tarball into the specified path

impl<W: Write> Archive<W>
[src]

fn append(&self, path: &str, file: &mut File) -> Result<()>

Add the file at the specified path to this archive.

This function will insert the file into the archive with the appropriate metadata set, returning any I/O error which occurs while writing.

Note that this will not attempt to seek the archive to a valid position, so if the archive is in the middle of a read or some other similar operation then this may corrupt the archive.

fn finish(&self) -> Result<()>

Finish writing this archive, emitting the termination sections.

This function is required to be called to complete the archive, it will be invalid if this is not called.

Trait Implementations

impl<'a, R: Read> Read for &'a Archive<R>
[src]

fn read(&mut self, into: &mut [u8]) -> Result<usize>

Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more

fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usizeError>
1.0.0

Read all bytes until EOF in this source, placing them into buf. Read more

fn read_to_string(&mut self, buf: &mut String) -> Result<usizeError>
1.0.0

Read all bytes until EOF in this source, placing them into buf. Read more

fn read_exact(&mut self, buf: &mut [u8]) -> Result<()Error>
1.6.0

Read the exact number of bytes required to fill buf. Read more

fn by_ref(&mut self) -> &mut Self
1.0.0

Creates a "by reference" adaptor for this instance of Read. Read more

fn bytes(self) -> Bytes<Self>
1.0.0

Transforms this Read instance to an Iterator over its bytes. Read more

fn chars(self) -> Chars<Self>

Unstable (io)

: the semantics of a partial read/write of where errors happen is currently unclear and may change

Transforms this Read instance to an Iterator over chars. Read more

fn chain<R>(self, next: R) -> Chain<Self, R> where R: Read
1.0.0

Creates an adaptor which will chain this stream with another. Read more

fn take(self, limit: u64) -> Take<Self>
1.0.0

Creates an adaptor which will read at most limit bytes from it. Read more