Module: Archive

### Home Classes Methods

### In Files

- libarchive.c

### Namespace

- CLASS Archive::Entry
- CLASS Archive::Error
- CLASS Archive::Reader
- CLASS Archive::Writer

### Methods

- ::read_open_filename
- ::read_open_memory
- ::version_number
- ::version_string
- ::write_open_filename
- ::write_open_memory

### Files

- README.txt

### Class/Module Index

Quicksearch

- Archive
- Archive::Entry
- Archive::Error
- Archive::Reader
- Archive::Writer

No matching classes.

# Archive

### Constants

COMPRESSION_BZIP2
COMPRESSION_COMPRESS
COMPRESSION_GZIP
COMPRESSION_LZMA
COMPRESSION_NONE
COMPRESSION_PROGRAM
EXTRACT_ACL
EXTRACT_FFLAGS
EXTRACT_NO_AUTODIR
EXTRACT_NO_OVERWRITE
EXTRACT_NO_OVERWRITE_NEWER
EXTRACT_OWNER
EXTRACT_PERM
EXTRACT_SECURE_NODOTDOT
EXTRACT_SECURE_SYMLINKS
EXTRACT_SPARSE
EXTRACT_TIME
EXTRACT_UNLINK
EXTRACT_XATTR
FORMAT_AR
FORMAT_AR_BSD
FORMAT_AR_GNU
FORMAT_BASE_MASK

  rb_define_const(rb_mArchive, "COMPRESSION_PROGRAM", INT2NUM(ARCHIVE_COMPRESSION_PROGRAM)); rb_define_const(rb_mArchive, "COMPRESSION_LZMA", INT2NUM(ARCHIVE_COMPRESSION_LZMA));

FORMAT_CPIO
FORMAT_CPIO_BIN_BE
FORMAT_CPIO_BIN_LE
FORMAT_CPIO_POSIX
FORMAT_CPIO_SVR4_CRC
FORMAT_CPIO_SVR4_NOCRC
FORMAT_EMPTY
FORMAT_ISO9660
FORMAT_ISO9660_ROCKRIDGE
FORMAT_MTREE
FORMAT_SHAR
FORMAT_SHAR_BASE
FORMAT_SHAR_DUMP
FORMAT_TAR
FORMAT_TAR_GNUTAR
FORMAT_TAR_PAX_INTERCHANGE
FORMAT_TAR_PAX_RESTRICTED
FORMAT_TAR_USTAR
FORMAT_ZIP
VERSION

### Public Class Methods

read_open_filename(p1, p2 = v2, p3 = v3) click to toggle source

    static VALUE rb_libarchive_reader_s_open_filename(int argc, VALUE *argv, VALUE self) {
      VALUE v_filename, v_compression, v_format;
      const char *filename = NULL;
      int compression = -1, format = -1;
      const char *cmd = NULL;
      rb_scan_args(argc, argv, "12", &v_filename, &v_compression, &v_format);
      Check_Type(v_filename, T_STRING);
      filename = RSTRING_PTR(v_filename);

      if (T_STRING == TYPE(v_compression)) {
        compression = -1;
        cmd = RSTRING_PTR(v_compression);
      } else if (!NIL_P(v_compression)) {
        compression = NUM2INT(v_compression);
      }

      if (!NIL_P(v_format)) {
        format = NUM2INT(v_format);
      }

      return rb_libarchive_reader_s_open0(rb_libarchive_reader_s_open_filename0, (void *) filename, compression, format, cmd);
    }

read_open_memory(p1, p2 = v2, p3 = v3) click to toggle source

    static VALUE rb_libarchive_reader_s_open_memory(int argc, VALUE *argv, VALUE self) {
      VALUE v_memory, v_compression, v_format;
      int compression = -1, format = -1;
      const char *cmd = NULL;
      rb_scan_args(argc, argv, "12", &v_memory, &v_compression, &v_format);
      Check_Type(v_memory, T_STRING);

      if (T_STRING == TYPE(v_compression)) {
        compression = -1;
        cmd = RSTRING_PTR(v_compression);
      } else if (!NIL_P(v_compression)) {
        compression = NUM2INT(v_compression);
      }

      if (!NIL_P(v_format)) {
        format = NUM2INT(v_format);
      }

      return rb_libarchive_reader_s_open0(rb_libarchive_reader_s_open_memory0, (void *) v_memory, compression, format, cmd);
    }

version_number() click to toggle source

    VALUE rb_libarchive_s_version_number(VALUE self) {
    #if ARCHIVE_VERSION >= 2005000
      return INT2NUM(archive_version_number());
    #else
      return INT2NUM(archive_version_stamp());
    #endif
    }

version_string() click to toggle source

    VALUE rb_libarchive_s_version_string(VALUE self) {
    #if ARCHIVE_VERSION_NUMBER >= 2005000
      return rb_str_new2(archive_version_string());
    #else
      return rb_str_new2(archive_version());
    #endif
    }

write_open_filename(p1, p2, p3) click to toggle source

    static VALUE rb_libarchive_writer_s_open_filename(VALUE self, VALUE v_filename, VALUE v_compression, VALUE v_format) {
      const char *filename = NULL;
      int compression, format;
      const char *cmd = NULL;
      Check_Type(v_filename, T_STRING);

      if (RSTRING_LEN(v_filename) < 1) {
        rb_raise(rb_eArchiveError, "Open writer failed: No such file or directory");
      }

      filename = RSTRING_PTR(v_filename);

      if (T_STRING == TYPE(v_compression)) {
        compression = -1;
        cmd = RSTRING_PTR(v_compression);
      } else {
        compression = NUM2INT(v_compression);
      }

      format = NUM2INT(v_format);
      return rb_libarchive_writer_s_open0(rb_libarchive_writer_s_open_filename0, (void *) filename, compression, format, cmd);
    }

write_open_memory(p1, p2, p3) click to toggle source

    static VALUE rb_libarchive_writer_s_open_memory(VALUE self, VALUE v_memory, VALUE v_compression, VALUE v_format) {
      int compression, format;
      const char *cmd = NULL;
      Check_Type(v_memory, T_STRING);

      if (T_STRING == TYPE(v_compression)) {
        compression = -1;
        cmd = RSTRING_PTR(v_compression);
      } else {
        compression = NUM2INT(v_compression);
      }

      format = NUM2INT(v_format);
      return rb_libarchive_writer_s_open0(rb_libarchive_writer_s_open_memory0, (void *) v_memory, compression, format, cmd);
    }

[Validate]

Generated with the Darkfish Rdoc Generator 2.