Path  Archive::Tar::Minitar::Reader::EntryStream

Parent

  • Object
Generated with Razzle Dazzle Redfish

[Validate]

EntryStream

EntryStreams are pseudo-streams on top of the main data stream.

Public Class Methods

new(header, anIO) click to toggle source

(Not documented)

# File vendor/path/minitar.rb, line 464
      def initialize(header, anIO)
        @io       = anIO
        @name     = header.name
        @mode     = header.mode
        @uid      = header.uid
        @gid      = header.gid
        @size     = header.size
        @mtime    = header.mtime
        @checksum = header.checksum
        @typeflag = header.typeflag
        @linkname = header.linkname
        @magic    = header.magic
        @version  = header.version
        @uname    = header.uname
        @gname    = header.gname
        @devmajor = header.devmajor
        @devminor = header.devminor
        @prefix   = header.prefix
        @read     = 0
        @orig_pos = @io.pos
      end

Public Instance Methods

bytes_read() click to toggle source

(Not documented)

# File vendor/path/minitar.rb, line 536
      def bytes_read
        @read
      end
close() click to toggle source

Closes the entry.

# File vendor/path/minitar.rb, line 550
      def close
        invalidate
      end
directory() click to toggle source

Alias for directory?

directory?() click to toggle source

Returns true if the entry represents a directory.

# File vendor/path/minitar.rb, line 507
      def directory?
        @typeflag == "5"
      end
Also aliased as: directory
eof?() click to toggle source

Returns true if the current read pointer is at the end of the EntryStream data.

# File vendor/path/minitar.rb, line 520
      def eof?
        @read >= @size
      end
file() click to toggle source

Alias for file?

file?() click to toggle source

Returns true if the entry represents a plain file.

# File vendor/path/minitar.rb, line 513
      def file?
        @typeflag == "0"
      end
Also aliased as: file
full_name() click to toggle source

Returns the full and proper name of the entry.

# File vendor/path/minitar.rb, line 541
      def full_name
        if @prefix != ""
          File.join(@prefix, @name)
        else
          @name
        end
      end
getc() click to toggle source

Reads one byte from the entry. Returns nil if there is no more data to read.

# File vendor/path/minitar.rb, line 499
      def getc
        return nil if @read >= @size
        ret = @io.getc
        @read += 1 if ret
        ret
      end
pos() click to toggle source

Returns the current read pointer in the EntryStream.

# File vendor/path/minitar.rb, line 525
      def pos
        @read
      end
read(len = nil) click to toggle source

Reads len bytes (or all remaining data) from the entry. Returns nil if there is no more data to read.

# File vendor/path/minitar.rb, line 488
      def read(len = nil)
        return nil if @read >= @size
        len ||= @size - @read
        max_read = [len, @size - @read].min
        ret = @io.read(max_read)
        @read += ret.size
        ret
      end
rewind() click to toggle source

Sets the current read pointer to the beginning of the EntryStream.

# File vendor/path/minitar.rb, line 530
      def rewind
        raise NonSeekableStream unless @io.respond_to?(:pos=)
        @io.pos = @orig_pos
        @read = 0
      end

Private Instance Methods

invalidate() click to toggle source

(Not documented)

# File vendor/path/minitar.rb, line 555
      def invalidate
        extend InvalidEntryStream
      end

Disabled; run with --debug to generate this.