text: crystal_doc_search_index_callback({"repository_name":"github.com/naqvis/crystar","body":"[![Build Status](https://travis-ci.org/naqvis/crystar.svg?branch=master)](https://travis-ci.org/naqvis/crystar)\n[![GitHub release](https://img.shields.io/github/release/naqvis/crystar.svg)](https://github.com/naqvis/crystar/releases)\n\n# Crystal Tar (Crystar)\n\nShard `Crystar` implements access to tar archives. \n\n*No external library needed.* This is written in **pure Crystal**.\n\nTape archives (tar) are a file format for storing a sequence of files that can be read and written in a streaming manner. This shard aims to cover most variations of the format, including those produced by **GNU** and **BSD** tar tools. \n\nThis module is mostly based on [`Tar`](https://golang.google.cn/pkg/archive/tar/) package implementation of [Golang](http://golang.org/)\n\n\n  Format represents the tar archive format.\n  \n  The original tar format was introduced in Unix V7.\n  Since then, there have been multiple competing formats attempting to\n  standardize or extend the **V7** format to overcome its limitations.\n  The most common formats are the **USTAR**, **PAX**, and **GNU** formats,\n  each with their own advantages and limitations.\n  \n  The following table captures the capabilities of each format:\n  \n  \t                  |  USTAR |       PAX |       GNU\n  \t------------------+--------+-----------+----------\n  \tName              |   256B | unlimited | unlimited\n  \tLinkname          |   100B | unlimited | unlimited\n  \tSize              | uint33 | unlimited |    uint89\n  \tMode              | uint21 |    uint21 |    uint57\n  \tUid/Gid           | uint21 | unlimited |    uint57\n  \tUname/Gname       |    32B | unlimited |       32B\n  \tModTime           | uint33 | unlimited |     int89\n  \tAccessTime        |    n/a | unlimited |     int89\n  \tChangeTime        |    n/a | unlimited |     int89\n  \tDevmajor/Devminor | uint21 |    uint21 |    uint57\n  \t------------------+--------+-----------+----------\n  \tstring encoding   |  ASCII |     UTF-8 |    binary\n  \tsub-second times  |     no |       yes |        no\n  \tsparse files      |     no |       yes |       yes\n  \n  The table's upper portion shows the Header fields, where each format reports\n  the maximum number of bytes allowed for each string field and\n  the integer type used to store each numeric field\n  (where timestamps are stored as the number of seconds since the Unix epoch).\n  \n  The table's lower portion shows specialized features of each format,\n  such as supported string encodings, support for sub-second timestamps,\n  or support for sparse files.\n  \n  The `Writer` currently provides **no support** for _sparse files_.\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n   ```yaml\n   dependencies:\n     crystar:\n       github: naqvis/crystar\n   ```\n\n2. Run `shards install`\n\n## Usage\n\n```crystal\nrequire \"crystar\"\n```\n\n`Crystar` module contains readers and writers for tar archive.\nTape archives (tar) are a file format for storing a sequence of files that can be read and written in a streaming manner.\nThis module aims to cover most variations of the format, including those produced by GNU and BSD tar tools.\n\n## Sample Usage\n```crystal\nfiles = [\n  {\"readme.txt\", \"This archive contains some text files.\"},\n  {\"minerals.txt\", \"Mineral names:\\nalunite\\nchromium\\nvlasovite\"},\n  {\"todo.txt\", \"Get crystal mining license.\"},\n]\n\nbuf = IO::Memory.new\nCrystar::Writer.open(buf) do |tw|\n  files.each_with_index do |f, _|\n    hdr = Header.new(\n      name: f[0],\n      mode: 0o600_i64,\n      size: f[1].size.to_i64\n    )\n    tw.write_header(hdr)\n    tw.write(f[1].to_slice)\n  end\nend\n#Open and iterate through the files in the archive\nbuf.pos = 0\nCrystar::Reader.open(buf) do |tar|\n  tar.each_entry do |entry|\n    p \"Contents of #{entry.name}\"\n    IO.copy entry.io, STDOUT\n    p \"\\n\"\n  end\nend\n```\n\nRefer to `Crystar::Reader` and `Crystar::Writer` module for documentation on detailed usage.\n\n# Development\n\nTo run all tests:\n\n```\ncrystal spec\n```\n\n# Contributing\n\n1. Fork it (<https://github.com/naqvis/crystar/fork>)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n# Contributors\n\n- [Ali Naqvi](https://github.com/naqvis) - creator and maintainer\n","program":{"html_id":"github.com/naqvis/crystar/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"github.com/naqvis/crystar","program":true,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":null,"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"github.com/naqvis/crystar/Crystar","path":"Crystar.html","kind":"module","full_name":"Crystar","name":"Crystar","abstract":false,"superclass":null,"ancestors":[],"locations":[{"filename":"tar/format.cr","line_number":1,"url":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/format.cr"},{"filename":"tar/helper.cr","line_number":3,"url":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/helper.cr"},{"filename":"tar/header.cr","line_number":4,"url":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr"},{"filename":"tar/reader.cr","line_number":4,"url":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/reader.cr"},{"filename":"tar/writer.cr","line_number":3,"url":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/writer.cr"},{"filename":"crystar.cr","line_number":37,"url":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/crystar.cr"}],"repository_name":"github.com/naqvis/crystar","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[{"id":"BASIC_KEYS","name":"BASIC_KEYS","value":"{PAX_PATH => true, PAX_LINK_PATH => true, PAX_SIZE => true, PAX_UID => true, PAX_GID => true, PAX_UNAME => true, PAX_GNAME => true, PAX_MTIME => true, PAX_ATIME => true, PAX_CTIME => true}","doc":null,"summary":null},{"id":"BLOCK","name":"BLOCK","value":"'4'","doc":"Character device node","summary":"<p>Character device node</p>"},{"id":"BLOCK_SIZE","name":"BLOCK_SIZE","value":"512","doc":null,"summary":null},{"id":"CHAR","name":"CHAR","value":"'3'","doc":"Symbolic link","summary":"<p>Symbolic link</p>"},{"id":"CONT","name":"CONT","value":"'7'","doc":null,"summary":null},{"id":"DIR","name":"DIR","value":"'5'","doc":"Block device node","summary":"<p>Block device node</p>"},{"id":"FIFO","name":"FIFO","value":"'6'","doc":"Directory","summary":"<p>Directory</p>"},{"id":"GNU_LONGLINK","name":"GNU_LONGLINK","value":"'K'","doc":null,"summary":null},{"id":"GNU_LONGNAME","name":"GNU_LONGNAME","value":"'L'","doc":"'L' and 'K' are used by teh GNU format for a meta file\nused to store the path or link name for the next file.","summary":"<p>'L' and 'K' are used by teh GNU format for a meta file used to store the path or link name for the next file.</p>"},{"id":"GNU_SPARSE","name":"GNU_SPARSE","value":"'S'","doc":"Used by PAX format to key-value records that are relevant to all subsequent files.","summary":"<p>Used by PAX format to key-value records that are relevant to all subsequent files.</p>"},{"id":"ISBLK","name":"ISBLK","value":"24576","doc":"Symbolic link","summary":"<p>Symbolic link</p>"},{"id":"ISCHR","name":"ISCHR","value":"8192","doc":"Block special file","summary":"<p>Block special file</p>"},{"id":"ISDIR","name":"ISDIR","value":"16384","doc":"Save text (sticky bit)\nCommon Unix mode constants; these are not defined in any common tar standard.\nHeader.FileInfo understands these, but FileInfoHeader will never produce these.\nCommon Unix mode constants; these are not defined in any common tar standard.\nHeader.FileInfo understands these, but FileInfoHeader will never produce these.","summary":"<p>Save text (sticky bit) Common Unix mode constants; these are not defined in any common tar standard.</p>"},{"id":"ISFIFO","name":"ISFIFO","value":"4096","doc":"Directory","summary":"<p>Directory</p>"},{"id":"ISGID","name":"ISGID","value":"1024","doc":"Set uid","summary":"<p>Set uid</p>"},{"id":"ISLINK","name":"ISLINK","value":"40960","doc":"Regular file","summary":"<p>Regular file</p>"},{"id":"ISREG","name":"ISREG","value":"32768","doc":"FIFO","summary":"<p>FIFO</p>"},{"id":"ISSOCK","name":"ISSOCK","value":"49152","doc":"Character special file","summary":"<p>Character special file</p>"},{"id":"ISUID","name":"ISUID","value":"2048","doc":"Mode constants from USTAR spec:\nSee http://pubs.opengroup.org/onlinepubs/9699919799/utilities/pax.html#tag_20_92_13_06","summary":"<p>Mode constants from USTAR spec: See http://pubs.opengroup.org/onlinepubs/9699919799/utilities/pax.html#tag_20_92_13_06</p>"},{"id":"ISVTX","name":"ISVTX","value":"512","doc":"Set gid","summary":"<p>Set gid</p>"},{"id":"LINK","name":"LINK","value":"'1'","doc":"'1' to '6' are header-only flags and may not have a data body.","summary":"<p>'1' to '6' are header-only flags and may not have a data body.</p>"},{"id":"MAGIC_GNU","name":"MAGIC_GNU","value":"\"ustar \"","doc":"Magics used to identify various formats.","summary":"<p>Magics used to identify various formats.</p>"},{"id":"MAGIC_USTAR","name":"MAGIC_USTAR","value":"\"ustar\\u0000\"","doc":null,"summary":null},{"id":"MAX_NANO_SECOND_DIGITS","name":"MAX_NANO_SECOND_DIGITS","value":"9","doc":null,"summary":null},{"id":"NAME_SIZE","name":"NAME_SIZE","value":"100","doc":"Size of each block in a tar stream","summary":"<p>Size of each block in a tar stream</p>"},{"id":"PADDING","name":"PADDING","value":"3","doc":null,"summary":null},{"id":"PAX_ATIME","name":"PAX_ATIME","value":"\"atime\"","doc":null,"summary":null},{"id":"PAX_CHARSET","name":"PAX_CHARSET","value":"\"charset\"","doc":"Removed from later revision of PAX spec, but was valid","summary":"<p>Removed from later revision of PAX spec, but was valid</p>"},{"id":"PAX_COMMENT","name":"PAX_COMMENT","value":"\"comment\"","doc":"Currently unused","summary":"<p>Currently unused</p>"},{"id":"PAX_CTIME","name":"PAX_CTIME","value":"\"ctime\"","doc":null,"summary":null},{"id":"PAX_GID","name":"PAX_GID","value":"\"gid\"","doc":null,"summary":null},{"id":"PAX_GNAME","name":"PAX_GNAME","value":"\"gname\"","doc":null,"summary":null},{"id":"PAX_GNU_SPARSE","name":"PAX_GNU_SPARSE","value":"\"GNU.sparse.\"","doc":"Keywords for GNU sparse files in a PAX extended header.","summary":"<p>Keywords for GNU sparse files in a PAX extended header.</p>"},{"id":"PAX_GNU_SPARSE_MAJOR","name":"PAX_GNU_SPARSE_MAJOR","value":"\"GNU.sparse.major\"","doc":null,"summary":null},{"id":"PAX_GNU_SPARSE_MAP","name":"PAX_GNU_SPARSE_MAP","value":"\"GNU.sparse.map\"","doc":null,"summary":null},{"id":"PAX_GNU_SPARSE_MINOR","name":"PAX_GNU_SPARSE_MINOR","value":"\"GNU.sparse.minor\"","doc":null,"summary":null},{"id":"PAX_GNU_SPARSE_NAME","name":"PAX_GNU_SPARSE_NAME","value":"\"GNU.sparse.name\"","doc":null,"summary":null},{"id":"PAX_GNU_SPARSE_NUMBLOCKS","name":"PAX_GNU_SPARSE_NUMBLOCKS","value":"\"GNU.sparse.numblocks\"","doc":null,"summary":null},{"id":"PAX_GNU_SPARSE_NUMBYTES","name":"PAX_GNU_SPARSE_NUMBYTES","value":"\"GNU.sparse.numbytes\"","doc":null,"summary":null},{"id":"PAX_GNU_SPARSE_OFFSET","name":"PAX_GNU_SPARSE_OFFSET","value":"\"GNU.sparse.offset\"","doc":null,"summary":null},{"id":"PAX_GNU_SPARSE_REALSIZE","name":"PAX_GNU_SPARSE_REALSIZE","value":"\"GNU.sparse.realsize\"","doc":null,"summary":null},{"id":"PAX_GNU_SPARSE_SIZE","name":"PAX_GNU_SPARSE_SIZE","value":"\"GNU.sparse.size\"","doc":null,"summary":null},{"id":"PAX_LINK_PATH","name":"PAX_LINK_PATH","value":"\"linkpath\"","doc":null,"summary":null},{"id":"PAX_MTIME","name":"PAX_MTIME","value":"\"mtime\"","doc":null,"summary":null},{"id":"PAX_NONE","name":"PAX_NONE","value":"\"\"","doc":"Keywords for PAX extended header records","summary":"<p>Keywords for PAX extended header records</p>"},{"id":"PAX_PATH","name":"PAX_PATH","value":"\"path\"","doc":"indicates that no PAX key is suitable","summary":"<p>indicates that no PAX key is suitable</p>"},{"id":"PAX_SCHILY_XATTR","name":"PAX_SCHILY_XATTR","value":"\"SCHILY.xattr.\"","doc":null,"summary":null},{"id":"PAX_SIZE","name":"PAX_SIZE","value":"\"size\"","doc":null,"summary":null},{"id":"PAX_UID","name":"PAX_UID","value":"\"uid\"","doc":null,"summary":null},{"id":"PAX_UNAME","name":"PAX_UNAME","value":"\"uname\"","doc":null,"summary":null},{"id":"PREFIX_SIZE","name":"PREFIX_SIZE","value":"155","doc":"Max length of the name in USTAR format","summary":"<p>Max length of the name in USTAR format</p>"},{"id":"REG","name":"REG","value":"'0'","doc":"Type flags for Header#flag","summary":"<p>Type flags for Header#flag</p>"},{"id":"REGA","name":"REGA","value":"'\\u{0}'","doc":null,"summary":null},{"id":"SYMLINK","name":"SYMLINK","value":"'2'","doc":"Hard link","summary":"<p>Hard link</p>"},{"id":"TRAILER_STAR","name":"TRAILER_STAR","value":"\"tar\\u0000\"","doc":null,"summary":null},{"id":"VERSION","name":"VERSION","value":"\"0.1.0\"","doc":null,"summary":null},{"id":"VERSION_GNU","name":"VERSION_GNU","value":"\" \\u0000\"","doc":null,"summary":null},{"id":"VERSION_USTAR","name":"VERSION_USTAR","value":"\"00\"","doc":null,"summary":null},{"id":"XGLOBAL_HEADER","name":"XGLOBAL_HEADER","value":"'g'","doc":"Used by PAX format to store key-value records that are only relevant to the next file.","summary":"<p>Used by PAX format to store key-value records that are only relevant to the next file.</p>"},{"id":"XHEADER","name":"XHEADER","value":"'x'","doc":"reserved","summary":"<p>reserved</p>"}],"included_modules":[],"extended_modules":[{"html_id":"github.com/naqvis/crystar/Crystar","kind":"module","full_name":"Crystar","name":"Crystar"}],"subclasses":[],"including_types":[],"namespace":null,"doc":"`Crystar` module contains readers and writers for tar archive.\nTape archives (tar) are a file format for storing a sequence of files that can be read and written in a streaming manner.\nThis module aims to cover most variations of the format, including those produced by GNU and BSD tar tools.\n\n### Example\n```\nfiles = [\n  {\"readme.txt\", \"This archive contains some text files.\"},\n  {\"minerals.txt\", \"Mineral names:\\nalunite\\nchromium\\nvlasovite\"},\n  {\"todo.txt\", \"Get crystal mining license.\"},\n]\nbuf = IO::Memory.new\nCrystar::Writer.open(buf) do |tw|\n  files.each_with_index do |f, _|\n    hdr = Header.new(\n      name: f[0],\n      mode: 0o600_i64,\n      size: f[1].size.to_i64\n    )\n    tw.write_header(hdr)\n    tw.write(f[1].to_slice)\n  end\nend\n\n# Open and iterate through the files in the archive\nbuf.pos = 0\nCrystar::Reader.open(buf) do |tar|\n  tar.each_entry do |entry|\n    p \"Contents of #{entry.name}\"\n    IO.copy entry.io, STDOUT\n    p \"\\n\"\n  end\nend\n```","summary":"<p><code><a href=\"Crystar.html\">Crystar</a></code> module contains readers and writers for tar archive.</p>","class_methods":[{"id":"parse_pax(r:IO):Hash(String,String)-class-method","html_id":"parse_pax(r:IO):Hash(String,String)-class-method","name":"parse_pax","doc":"parse_pax parses PAX headers\nIf an extended header (type 'x') is invalid, exception is raised","summary":"<p>parse_pax parses PAX headers If an extended header (type 'x') is invalid, exception is raised</p>","abstract":false,"args":[{"name":"r","doc":null,"default_value":"","external_name":"r","restriction":"IO"}],"args_string":"(r : IO) : Hash(String, String)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/reader.cr#L555","def":{"name":"parse_pax","args":[{"name":"r","doc":null,"default_value":"","external_name":"r","restriction":"IO"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Hash(String, String)","visibility":"Public","body":"sbuf = r.gets_to_end\nsparse_map = [] of String\npax_hdrs = {} of String => String\nwhile sbuf.size > 0\n  key, val, residual = parse_pax_record(sbuf)\n  sbuf = residual\n  case key\n  when PAX_GNU_SPARSE_OFFSET, PAX_GNU_SPARSE_NUMBYTES\n    if ((((sparse_map.size % 2) == 0) && (key != PAX_GNU_SPARSE_OFFSET)) || (((sparse_map.size % 2) == 1) && (key != PAX_GNU_SPARSE_NUMBYTES))) || (val.includes?(\",\"))\n      raise(\"invalid header\")\n    end\n    sparse_map << val\n  else\n    pax_hdrs[key] = val\n  end\nend\nif sparse_map.size > 0\n  pax_hdrs[PAX_GNU_SPARSE_MAP] = sparse_map.join(\",\")\nend\npax_hdrs\n"}},{"id":"read_gnu_sparse_map0x1(pax_hdrs:Hash(String,String))-class-method","html_id":"read_gnu_sparse_map0x1(pax_hdrs:Hash(String,String))-class-method","name":"read_gnu_sparse_map0x1","doc":"read_gnu_sparse_map0x1 reads the sparse map as stored in GNU's PAX sparse format\nversion 0.1. The sparse map is stored in the PAX headers.","summary":"<p>read_gnu_sparse_map0x1 reads the sparse map as stored in GNU's PAX sparse format version 0.1.</p>","abstract":false,"args":[{"name":"pax_hdrs","doc":null,"default_value":"","external_name":"pax_hdrs","restriction":"Hash(String, String)"}],"args_string":"(pax_hdrs : Hash(String, String))","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/reader.cr#L648","def":{"name":"read_gnu_sparse_map0x1","args":[{"name":"pax_hdrs","doc":null,"default_value":"","external_name":"pax_hdrs","restriction":"Hash(String, String)"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"num_entries_str = pax_hdrs[PAX_GNU_SPARSE_NUMBLOCKS]\nbegin\n  num_entries = num_entries_str.to_i\nrescue ex\n  num_entries = 0\nend\nif num_entries < 0 || (2 * num_entries) < num_entries\n  raise(Error.new(\"Invalid header\"))\nend\nsparse_map = pax_hdrs[PAX_GNU_SPARSE_MAP].split(\",\")\nif (sparse_map.size == 1) && sparse_map[0].blank?\n  sparse_map = sparse_map[..0]\nend\nif sparse_map.size != (2 * num_entries)\n  raise(\"invalid header\")\nend\nspd = SparseDatas.new(num_entries)\nwhile sparse_map.size >= 2\n  offset = sparse_map[0].to_i64\n  length = sparse_map[1].to_i64\n  spd << (SparseEntry.new(offset, length))\n  sparse_map = sparse_map[2..]\nend\nspd\n"}},{"id":"read_gnu_sparse_map1x0(r:IO)-class-method","html_id":"read_gnu_sparse_map1x0(r:IO)-class-method","name":"read_gnu_sparse_map1x0","doc":"read_gnu_sparse_map1x0 reads the sparse map as stored in GNU's PAX sparse format\nversion 1.0. The format of the sparse map consists of a series of\nnewline-terminated numeric fields. The first field is the number of entries\nand is always present. Following this are the entries, consisting of two\nfields (offset, length). This function must stop reading at the end\nboundary of the block containing the last newline.\n\nNote that the GNU manual says that numeric values should be encoded in octal\nformat. However, the GNU tar utility itself outputs these values in decimal.\nAs such, this library treats values as being encoded in decimal.","summary":"<p>read_gnu_sparse_map1x0 reads the sparse map as stored in GNU's PAX sparse format version 1.0.</p>","abstract":false,"args":[{"name":"r","doc":null,"default_value":"","external_name":"r","restriction":"IO"}],"args_string":"(r : IO)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/reader.cr#L596","def":{"name":"read_gnu_sparse_map1x0","args":[{"name":"r","doc":null,"default_value":"","external_name":"r","restriction":"IO"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"cnt_new_line = 0\nbuf = IO::Memory.new\nblk = Block.new\nread_pos = 0\nfeed_tokens = ->(n : Int32) do\n  while cnt_new_line < n\n    r.read(blk.to_bytes[..])\n    buf.seek(0, IO::Seek::End)\n    buf.write(blk.to_bytes)\n    blk.to_bytes.each_with_index do |b, i|\n      if b == '\\n'.ord\n        cnt_new_line = cnt_new_line + 1\n      end\n    end\n  end\nend\nnext_token = -> do\n  buf.pos = read_pos\n  cnt_new_line = cnt_new_line - 1\n  tok = buf.gets(chomp: true)\n  read_pos = buf.pos\n  tok.nil? ? \"0\" : tok\nend\nfeed_tokens.call(1)\nnum_entries = next_token.call.to_i do\n  0\nend\nif num_entries < 0 || (2 * num_entries) < num_entries\n  raise(Error.new(\"Invalid header\"))\nend\nfeed_tokens.call(2 * num_entries)\nspd = SparseDatas.new(num_entries)\n0.upto(num_entries - 1) do |i|\n  offset = next_token.call.to_i64\n  length = next_token.call.to_i64\n  spd << (SparseEntry.new(offset, length))\nend\nspd\n"}},{"id":"try_read_full(r:IO,b:Bytes)-class-method","html_id":"try_read_full(r:IO,b:Bytes)-class-method","name":"try_read_full","doc":"is like read_fully except it returns\nEOF when it is hit before b.size bytes are read","summary":"<p>is like read_fully except it returns EOF when it is hit before b.size bytes are read</p>","abstract":false,"args":[{"name":"r","doc":null,"default_value":"","external_name":"r","restriction":"IO"},{"name":"b","doc":null,"default_value":"","external_name":"b","restriction":"Bytes"}],"args_string":"(r : IO, b : Bytes)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/reader.cr#L680","def":{"name":"try_read_full","args":[{"name":"r","doc":null,"default_value":"","external_name":"r","restriction":"IO"},{"name":"b","doc":null,"default_value":"","external_name":"b","restriction":"Bytes"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"n = 0\neof = false\nwhile b.size > n && (!eof)\n  nn = r.read(b[n..])\n  eof = nn == 0\n  n = n + nn\nend\nn\n"}}],"constructors":[],"instance_methods":[{"id":"align_sparse_entries(src:Array(SparseEntry),size:Int64)-instance-method","html_id":"align_sparse_entries(src:Array(SparseEntry),size:Int64)-instance-method","name":"align_sparse_entries","doc":"align_sparse_entries mutates src and returns dst where each fragment's\nstarting offset is aligned up to the nearest block edge, and each\nending offset is aligned down to the nearest block edge.\n\nEven though the Crystar Reader and the BSD tar utility can handle entries\nwith arbitrary offsets and lengths, the GNU tar utility can only handle\noffsets and lengths that are multiples of blockSize.","summary":"<p>align_sparse_entries mutates src and returns dst where each fragment's starting offset is aligned up to the nearest block edge, and each ending offset is aligned down to the nearest block edge.</p>","abstract":false,"args":[{"name":"src","doc":null,"default_value":"","external_name":"src","restriction":"Array(SparseEntry)"},{"name":"size","doc":null,"default_value":"","external_name":"size","restriction":"Int64"}],"args_string":"(src : Array(SparseEntry), size : Int64)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L379","def":{"name":"align_sparse_entries","args":[{"name":"src","doc":null,"default_value":"","external_name":"src","restriction":"Array(SparseEntry)"},{"name":"size","doc":null,"default_value":"","external_name":"size","restriction":"Int64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"dst = src[...0]\nsrc.each_with_index do |s, _|\n  p, e = s.offset, s.end_of_offset\n  p = p + (block_padding(+p))\n  if e != size\n    e = e - (block_padding(-e))\n  end\n  if p < e\n    dst << (SparseEntry.new(p, e - p))\n  end\nend\ndst\n"}},{"id":"block_padding(offset:Int)-instance-method","html_id":"block_padding(offset:Int)-instance-method","name":"block_padding","doc":"blockPadding computes the number of bytes needed to pad offset up to the\nnearest block edge where 0 <= n < blockSize.","summary":"<p>blockPadding computes the number of bytes needed to pad offset up to the nearest block edge where 0 &lt;= n &lt; blockSize.</p>","abstract":false,"args":[{"name":"offset","doc":null,"default_value":"","external_name":"offset","restriction":"Int"}],"args_string":"(offset : Int)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/format.cr#L120","def":{"name":"block_padding","args":[{"name":"offset","doc":null,"default_value":"","external_name":"offset","restriction":"Int"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(-offset.to_i64) & (BLOCK_SIZE - 1)"}},{"id":"byte_index(s:String,c:Char)-instance-method","html_id":"byte_index(s:String,c:Char)-instance-method","name":"byte_index","doc":null,"summary":null,"abstract":false,"args":[{"name":"s","doc":null,"default_value":"","external_name":"s","restriction":"String"},{"name":"c","doc":null,"default_value":"","external_name":"c","restriction":"Char"}],"args_string":"(s : String, c : Char)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/helper.cr#L193","def":{"name":"byte_index","args":[{"name":"s","doc":null,"default_value":"","external_name":"s","restriction":"String"},{"name":"c","doc":null,"default_value":"","external_name":"c","restriction":"Char"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"byte_index(s.to_slice, c.ord)"}},{"id":"byte_index(bytes:Bytes,b:Int)-instance-method","html_id":"byte_index(bytes:Bytes,b:Int)-instance-method","name":"byte_index","doc":null,"summary":null,"abstract":false,"args":[{"name":"bytes","doc":null,"default_value":"","external_name":"bytes","restriction":"Bytes"},{"name":"b","doc":null,"default_value":"","external_name":"b","restriction":"Int"}],"args_string":"(bytes : Bytes, b : Int)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/helper.cr#L184","def":{"name":"byte_index","args":[{"name":"bytes","doc":null,"default_value":"","external_name":"bytes","restriction":"Bytes"},{"name":"b","doc":null,"default_value":"","external_name":"b","restriction":"Int"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"0.upto(bytes.size - 1) do |i|\n  if bytes[i] == b\n    return i\n  end\nend\n-1\n"}},{"id":"file_info_header(fi:File,link:String)-instance-method","html_id":"file_info_header(fi:File,link:String)-instance-method","name":"file_info_header","doc":"file_info_header creates a partially-populated Header from *fi*.\nIf *fi* describes a symlink, this records link as the link target.\nIf *fi* describes a directory, a slash is appended to the name.","summary":"<p>file_info_header creates a partially-populated Header from <em>fi</em>.</p>","abstract":false,"args":[{"name":"fi","doc":null,"default_value":"","external_name":"fi","restriction":"File"},{"name":"link","doc":null,"default_value":"","external_name":"link","restriction":"String"}],"args_string":"(fi : File, link : String)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L492","def":{"name":"file_info_header","args":[{"name":"fi","doc":null,"default_value":"","external_name":"fi","restriction":"File"},{"name":"link","doc":null,"default_value":"","external_name":"link","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"info = File.info(fi.path, follow_symlinks: false)\nbname = File.basename(fi.path)\nh = Header.new(name: bname, mod_time: info.modification_time, mode: info.permissions.value.to_i64, uid: info.owner.to_i32, gid: info.group.to_i32)\ncase info.type\nwhen .file?\n  h.flag = REG.ord.to_u8\n  h.size = fi.size\nwhen .directory?\n  h.flag = DIR.ord.to_u8\n  h.name = h.name + \"/\"\nwhen .symlink?\n  h.flag = SYMLINK.ord.to_u8\n  h.link_name = link\nwhen .character_device?\n  h.flag = CHAR.ord.to_u8\nwhen .block_device?\n  h.flag = BLOCK.ord.to_u8\nwhen .pipe?\n  h.flag = FIFO.ord.to_u8\nwhen .socket?\n  raise(\"Crystar Lib: sockets not supported\")\nelse\n  raise(\"Crystar Lib: unknown file type #{info}\")\nend\ncase info.flags\nwhen .set_user?\n  h.mode = h.mode | ISUID\nwhen .set_group?\n  h.mode = h.mode | ISGID\nwhen .sticky?\n  h.mode = h.mode | ISVTX\nend\nh\n"}},{"id":"fits_in_base256(n:Int32,x:Int64)-instance-method","html_id":"fits_in_base256(n:Int32,x:Int64)-instance-method","name":"fits_in_base256","doc":null,"summary":null,"abstract":false,"args":[{"name":"n","doc":null,"default_value":"","external_name":"n","restriction":"Int32"},{"name":"x","doc":null,"default_value":"","external_name":"x","restriction":"Int64"}],"args_string":"(n : Int32, x : Int64)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/helper.cr#L60","def":{"name":"fits_in_base256","args":[{"name":"n","doc":null,"default_value":"","external_name":"n","restriction":"Int32"},{"name":"x","doc":null,"default_value":"","external_name":"x","restriction":"Int64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"bin_bits = (n - 1).to_u32 * 8\nn >= 9 || (x >= (-1_i64 << bin_bits) && x < (1_i64 << bin_bits))\n"}},{"id":"fits_in_octal(n:Int32,x:Int64)-instance-method","html_id":"fits_in_octal(n:Int32,x:Int64)-instance-method","name":"fits_in_octal","doc":"fits_in_octal reports whether the integer x fits in a field n-bytes long\nusing octal encoding with the appropriate NUL terminator.","summary":"<p>fits_in_octal reports whether the integer x fits in a field n-bytes long using octal encoding with the appropriate NUL terminator.</p>","abstract":false,"args":[{"name":"n","doc":null,"default_value":"","external_name":"n","restriction":"Int32"},{"name":"x","doc":null,"default_value":"","external_name":"x","restriction":"Int64"}],"args_string":"(n : Int32, x : Int64)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/helper.cr#L67","def":{"name":"fits_in_octal","args":[{"name":"n","doc":null,"default_value":"","external_name":"n","restriction":"Int32"},{"name":"x","doc":null,"default_value":"","external_name":"x","restriction":"Int64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"oct_bits = (n - 1).to_u32 * 3\nx >= 0 && (n >= 22 || x < (1_i64 << oct_bits))\n"}},{"id":"format_pax_record(k:String,v:String)-instance-method","html_id":"format_pax_record(k:String,v:String)-instance-method","name":"format_pax_record","doc":"format_pax_record formats a single PAX record, prefixing it with the\nappropriate length","summary":"<p>format_pax_record formats a single PAX record, prefixing it with the appropriate length</p>","abstract":false,"args":[{"name":"k","doc":null,"default_value":"","external_name":"k","restriction":"String"},{"name":"v","doc":null,"default_value":"","external_name":"v","restriction":"String"}],"args_string":"(k : String, v : String)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/helper.cr#L152","def":{"name":"format_pax_record","args":[{"name":"k","doc":null,"default_value":"","external_name":"k","restriction":"String"},{"name":"v","doc":null,"default_value":"","external_name":"v","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if valid_pax_record(k, v)\nelse\n  raise(Error.new(\"invalid tar header\"))\nend\nsize = (k.bytesize + v.bytesize) + PADDING\nsize = size + size.to_s.size\nrec = \"#{size} #{k}=#{v}\\n\"\nif rec.bytesize != size\n  size = rec.bytesize\n  rec = \"#{size} #{k}=#{v}\\n\"\nend\nrec\n"}},{"id":"format_pax_time(ts:Time)-instance-method","html_id":"format_pax_time(ts:Time)-instance-method","name":"format_pax_time","doc":"format_pax_time converts ts into a time of the form %d.%d as described in the\nPAX specification. This function is capable of negative timestamps.","summary":"<p>format_pax_time converts ts into a time of the form %d.%d as described in the PAX specification.</p>","abstract":false,"args":[{"name":"ts","doc":null,"default_value":"","external_name":"ts","restriction":"Time"}],"args_string":"(ts : Time)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/helper.cr#L108","def":{"name":"format_pax_time","args":[{"name":"ts","doc":null,"default_value":"","external_name":"ts","restriction":"Time"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"secs, nsecs = ts.to_unix, ts.nanosecond\nif nsecs == 0\n  return secs.to_s\nend\nsign = \"\"\nif secs < 0\n  sign = \"-\"\n  secs = -(secs + 1)\n  nsecs = -(nsecs - 1e9)\nend\n(sprintf(\"%s%d.%09d\", [sign, secs, nsecs])).rstrip(\"0\")\n"}},{"id":"has_nul(s:String)-instance-method","html_id":"has_nul(s:String)-instance-method","name":"has_nul","doc":"checks whether NUL character exists within s","summary":"<p>checks whether NUL character exists within s</p>","abstract":false,"args":[{"name":"s","doc":null,"default_value":"","external_name":"s","restriction":"String"}],"args_string":"(s : String)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/helper.cr#L10","def":{"name":"has_nul","args":[{"name":"s","doc":null,"default_value":"","external_name":"s","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"s.byte_index(0) ? true : false"}},{"id":"header_only_type?(flag)-instance-method","html_id":"header_only_type?(flag)-instance-method","name":"header_only_type?","doc":null,"summary":null,"abstract":false,"args":[{"name":"flag","doc":null,"default_value":"","external_name":"flag","restriction":""}],"args_string":"(flag)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L412","def":{"name":"header_only_type?","args":[{"name":"flag","doc":null,"default_value":"","external_name":"flag","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"case flag\nwhen LINK, SYMLINK, CHAR, BLOCK, DIR, FIFO\n  true\nelse\n  false\nend"}},{"id":"invert_sparse_entries(src:Array(SparseEntry),size:Int64)-instance-method","html_id":"invert_sparse_entries(src:Array(SparseEntry),size:Int64)-instance-method","name":"invert_sparse_entries","doc":"invert_sparse_entries converts a sparse map from one form to the other.\nIf the input is sparseHoles, then it will output sparseDatas and vice-versa.\nThe input must have been already validated.\n\nThis function mutates src and returns a normalized map where:\n\t* adjacent fragments are coalesced together\n\t* only the last fragment may be empty\n\t* the endOffset of the last fragment is the total size","summary":"<p>invert_sparse_entries converts a sparse map from one form to the other.</p>","abstract":false,"args":[{"name":"src","doc":null,"default_value":"","external_name":"src","restriction":"Array(SparseEntry)"},{"name":"size","doc":null,"default_value":"","external_name":"size","restriction":"Int64"}],"args_string":"(src : Array(SparseEntry), size : Int64)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L398","def":{"name":"invert_sparse_entries","args":[{"name":"src","doc":null,"default_value":"","external_name":"src","restriction":"Array(SparseEntry)"},{"name":"size","doc":null,"default_value":"","external_name":"size","restriction":"Int64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"dst = src[...0]\npre = SparseEntry.new(0, 0)\nsrc.each_with_index do |cur, _|\n  if cur.length == 0\n    next\n  end\n  pre.length = cur.offset - pre.offset\n  if pre.length > 0\n    dst << pre\n  end\n  pre.offset = cur.end_of_offset\nend\npre.length = size - pre.offset\ndst << pre\ndst\n"}},{"id":"ltrim(b:Bytes,s:String)-instance-method","html_id":"ltrim(b:Bytes,s:String)-instance-method","name":"ltrim","doc":null,"summary":null,"abstract":false,"args":[{"name":"b","doc":null,"default_value":"","external_name":"b","restriction":"Bytes"},{"name":"s","doc":null,"default_value":"","external_name":"s","restriction":"String"}],"args_string":"(b : Bytes, s : String)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/helper.cr#L197","def":{"name":"ltrim","args":[{"name":"b","doc":null,"default_value":"","external_name":"b","restriction":"Bytes"},{"name":"s","doc":null,"default_value":"","external_name":"s","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"left = 0\nb.each_with_index do |c, i|\n  if s.includes?(c.unsafe_chr)\n    left = left + 1\n  else\n    break\n  end\nend\nb[left..]\n"}},{"id":"merge_pax(hdr:Header,pax_hdrs:Hash(String,String))-instance-method","html_id":"merge_pax(hdr:Header,pax_hdrs:Hash(String,String))-instance-method","name":"merge_pax","doc":"merg_pax merges paxHdrs into hdr for all relevant fields of Header.","summary":"<p>merg_pax merges paxHdrs into hdr for all relevant fields of Header.</p>","abstract":false,"args":[{"name":"hdr","doc":null,"default_value":"","external_name":"hdr","restriction":"Header"},{"name":"pax_hdrs","doc":null,"default_value":"","external_name":"pax_hdrs","restriction":"Hash(String, String)"}],"args_string":"(hdr : Header, pax_hdrs : Hash(String, String))","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/reader.cr#L520","def":{"name":"merge_pax","args":[{"name":"hdr","doc":null,"default_value":"","external_name":"hdr","restriction":"Header"},{"name":"pax_hdrs","doc":null,"default_value":"","external_name":"pax_hdrs","restriction":"Hash(String, String)"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"pax_hdrs.each do |k, v|\n  if v.blank?\n    next\n  end\n  case k\n  when PAX_PATH\n    hdr.name = v\n  when PAX_LINK_PATH\n    hdr.link_name = v\n  when PAX_UNAME\n    hdr.uname = v\n  when PAX_GNAME\n    hdr.gname = v\n  when PAX_UID\n    hdr.uid = v.to_i64\n  when PAX_GID\n    hdr.gid = v.to_i64\n  when PAX_ATIME\n    hdr.access_time = parse_pax_time(v)\n  when PAX_MTIME\n    hdr.mod_time = parse_pax_time(v)\n  when PAX_CTIME\n    hdr.change_time = parse_pax_time(v)\n  when PAX_SIZE\n    hdr.size = v.to_i64\n  else\n    if k.starts_with?(PAX_SCHILY_XATTR)\n      hdr.xattr[k[PAX_SCHILY_XATTR.size..]] = v\n    end\n  end\nend\nhdr.pax_records = pax_hdrs\n"}},{"id":"parse_pax_record(s:String):::Tuple(String,String,String)-instance-method","html_id":"parse_pax_record(s:String):::Tuple(String,String,String)-instance-method","name":"parse_pax_record","doc":"parse_pax_record parses the input PAX record string into a key-value pair.\nIf parsing is successful, it will slice off the currently read record and\nreturn the remainder as r.","summary":"<p>parse_pax_record parses the input PAX record string into a key-value pair.</p>","abstract":false,"args":[{"name":"s","doc":null,"default_value":"","external_name":"s","restriction":"String"}],"args_string":"(s : String) : ::Tuple(String, String, String)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/helper.cr#L125","def":{"name":"parse_pax_record","args":[{"name":"s","doc":null,"default_value":"","external_name":"s","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"::Tuple(String, String, String)","visibility":"Public","body":"sp = byte_index(s, ' ')\nif sp >= 0\nelse\n  raise(Error.new(\"invalid tar header\"))\nend\nn = s[...sp].to_i do\n  0\nend\nif n < 5 || s.bytesize < n\n  raise(Error.new(\"invalid tar header\"))\nend\nrec = s.byte_slice(sp + 1, (n - sp) - 2)\nnl = s.byte_slice(n - 1, 1)\nrem = s.byte_slice(n)\nif nl == \"\\n\"\nelse\n  raise(Error.new(\"invalid tar header\"))\nend\neq = byte_index(rec, '=')\nif eq >= 0\nelse\n  return {\"\", \"\", s}\nend\nk = rec.byte_slice(0, eq)\nv = rec.byte_slice(eq + 1)\nif valid_pax_record(k, v)\nelse\n  raise(Error.new(\"invalid tar header\"))\nend\n{k, v, rem}\n"}},{"id":"parse_pax_time(s:String)-instance-method","html_id":"parse_pax_time(s:String)-instance-method","name":"parse_pax_time","doc":"parse_pax_time takes a string of the form %d.%d as described in the PAX\nspecification. Note that this implementation allows for negative timestamps,\nwhich is allowed for by the PAX specification, but not always portable.","summary":"<p>parse_pax_time takes a string of the form %d.%d as described in the PAX specification.</p>","abstract":false,"args":[{"name":"s","doc":null,"default_value":"","external_name":"s","restriction":"String"}],"args_string":"(s : String)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/helper.cr#L75","def":{"name":"parse_pax_time","args":[{"name":"s","doc":null,"default_value":"","external_name":"s","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if s.size > 0\nelse\n  return unix_time(0, 0)\nend\nss, sn = s, \"\"\nif (pos = s.index('.')) && (pos >= 0)\n  ss, sn = s[...pos], s[(pos + 1)..]\nend\nbegin\n  secs = ss.to_i64\nrescue\n  raise(Error.new(\"invalid tar header\"))\nend\nif sn.size > 0\nelse\n  return unix_time(secs, 0)\nend\nif (sn.strip(\"0123456789\")) == \"\"\nelse\n  raise(\"invalid tar header\")\nend\nif sn.size < MAX_NANO_SECOND_DIGITS\n  sn = sn + (\"0\" * (MAX_NANO_SECOND_DIGITS - sn.size))\nelse\n  sn = sn[...MAX_NANO_SECOND_DIGITS]\nend\nnsecs = sn.to_i64\nif ss.size > 0 && (ss[0] == '-')\n  return unix_time(secs, -1 * nsecs)\nend\nunix_time(secs, nsecs)\n"}},{"id":"rtrim(b:Bytes,s:String)-instance-method","html_id":"rtrim(b:Bytes,s:String)-instance-method","name":"rtrim","doc":null,"summary":null,"abstract":false,"args":[{"name":"b","doc":null,"default_value":"","external_name":"b","restriction":"Bytes"},{"name":"s","doc":null,"default_value":"","external_name":"s","restriction":"String"}],"args_string":"(b : Bytes, s : String)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/helper.cr#L209","def":{"name":"rtrim","args":[{"name":"b","doc":null,"default_value":"","external_name":"b","restriction":"Bytes"},{"name":"s","doc":null,"default_value":"","external_name":"s","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"a = b.dup.reverse!\nright = b.size - 1\na.each_with_index do |c, i|\n  if s.includes?(c.unsafe_chr)\n    right = right - 1\n  else\n    break\n  end\nend\nb[..right]\n"}},{"id":"split_ustar_path(name:String)-instance-method","html_id":"split_ustar_path(name:String)-instance-method","name":"split_ustar_path","doc":null,"summary":null,"abstract":false,"args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":"String"}],"args_string":"(name : String)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/helper.cr#L32","def":{"name":"split_ustar_path","args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"length = name.size\nif length <= NAME_SIZE || (!name.ascii_only?)\n  return {\"\", \"\", false}\nend\nif length > (PREFIX_SIZE + 1)\n  length = PREFIX_SIZE + 1\nend\nif (name.char_at(name.size - 1)) == '/'\n  length = length - 1\nend\ni = name[..length].rindex(\"/\")\nif !i\n  return {\"\", \"\", false}\nelse\n  nlen = (name.size - i) - 1\n  plen = i\n  if ((i <= 0 || nlen > NAME_SIZE) || (nlen == 0)) || plen > PREFIX_SIZE\n    return {\"\", \"\", false}\n  else\n    return {name[..i], name[(i + 1)..], true}\n  end\nend\n"}},{"id":"to_ascii(s:String)-instance-method","html_id":"to_ascii(s:String)-instance-method","name":"to_ascii","doc":"to_ascii converts the input to an ASCII C-style string.\nThis a best effort conversion, so invalid characters are dropped.","summary":"<p>to_ascii converts the input to an ASCII C-style string.</p>","abstract":false,"args":[{"name":"s","doc":null,"default_value":"","external_name":"s","restriction":"String"}],"args_string":"(s : String)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/helper.cr#L16","def":{"name":"to_ascii","args":[{"name":"s","doc":null,"default_value":"","external_name":"s","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if s.ascii_only?\n  return s\nend\nb = Bytes.new(s.size)\nindex = 0\ns.bytes.each_with_index do |c, _|\n  if c < 128 && (c != 0)\n    b[index] = c\n    index = index + 1\n  end\nend\nString.new(b[...index])\n"}},{"id":"trim_bytes(b:Bytes,s:String)-instance-method","html_id":"trim_bytes(b:Bytes,s:String)-instance-method","name":"trim_bytes","doc":null,"summary":null,"abstract":false,"args":[{"name":"b","doc":null,"default_value":"","external_name":"b","restriction":"Bytes"},{"name":"s","doc":null,"default_value":"","external_name":"s","restriction":"String"}],"args_string":"(b : Bytes, s : String)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/helper.cr#L222","def":{"name":"trim_bytes","args":[{"name":"b","doc":null,"default_value":"","external_name":"b","restriction":"Bytes"},{"name":"s","doc":null,"default_value":"","external_name":"s","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"rtrim(ltrim(b, s), s)"}},{"id":"unix_time(sec:Int,nsec:Int)-instance-method","html_id":"unix_time(sec:Int,nsec:Int)-instance-method","name":"unix_time","doc":null,"summary":null,"abstract":false,"args":[{"name":"sec","doc":null,"default_value":"","external_name":"sec","restriction":"Int"},{"name":"nsec","doc":null,"default_value":"","external_name":"nsec","restriction":"Int"}],"args_string":"(sec : Int, nsec : Int)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/helper.cr#L226","def":{"name":"unix_time","args":[{"name":"sec","doc":null,"default_value":"","external_name":"sec","restriction":"Int"},{"name":"nsec","doc":null,"default_value":"","external_name":"nsec","restriction":"Int"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"ts = Time.unix(sec)\nts.shift(0, nsec)\n"}},{"id":"unix_time(sec,nsec)-instance-method","html_id":"unix_time(sec,nsec)-instance-method","name":"unix_time","doc":null,"summary":null,"abstract":false,"args":[{"name":"sec","doc":null,"default_value":"","external_name":"sec","restriction":""},{"name":"nsec","doc":null,"default_value":"","external_name":"nsec","restriction":""}],"args_string":"(sec, nsec)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/helper.cr#L231","def":{"name":"unix_time","args":[{"name":"sec","doc":null,"default_value":"","external_name":"sec","restriction":""},{"name":"nsec","doc":null,"default_value":"","external_name":"nsec","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"unix_time(sec.to_i64, nsec.to_i64)"}},{"id":"valid_pax_record(k:String,v:String)-instance-method","html_id":"valid_pax_record(k:String,v:String)-instance-method","name":"valid_pax_record","doc":"valid_pax_record reports whether the key-value pair is valid where each\nrecord is formatted as:\n\t\"%d %s=%s\\n\" % (size, key, value)\n\nKeys and values should be UTF-8, but the number of bad writers out there\nforces us to be a more liberal.\nThus, we only reject all keys with NUL, and only reject NULs in values\nfor the PAX version of the USTAR string fields.\nThe key must not contain an '=' character.","summary":"<p>valid_pax_record reports whether the key-value pair is valid where each record is formatted as: \t\"%d %s=%s\\n\" % (size, key, value)</p>","abstract":false,"args":[{"name":"k","doc":null,"default_value":"","external_name":"k","restriction":"String"},{"name":"v","doc":null,"default_value":"","external_name":"v","restriction":"String"}],"args_string":"(k : String, v : String)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/helper.cr#L174","def":{"name":"valid_pax_record","args":[{"name":"k","doc":null,"default_value":"","external_name":"k","restriction":"String"},{"name":"v","doc":null,"default_value":"","external_name":"v","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if k.blank? || (byte_index(k, '=')) >= 0\n  return false\nend\ncase k\nwhen PAX_PATH, PAX_LINK_PATH, PAX_UNAME, PAX_GNAME\n  !(has_nul(v))\nelse\n  !(has_nul(k))\nend\n"}},{"id":"validate_sparse_entries(sp:Array(SparseEntry),size:Int64)-instance-method","html_id":"validate_sparse_entries(sp:Array(SparseEntry),size:Int64)-instance-method","name":"validate_sparse_entries","doc":null,"summary":null,"abstract":false,"args":[{"name":"sp","doc":null,"default_value":"","external_name":"sp","restriction":"Array(SparseEntry)"},{"name":"size","doc":null,"default_value":"","external_name":"size","restriction":"Int64"}],"args_string":"(sp : Array(SparseEntry), size : Int64)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L353","def":{"name":"validate_sparse_entries","args":[{"name":"sp","doc":null,"default_value":"","external_name":"sp","restriction":"Array(SparseEntry)"},{"name":"size","doc":null,"default_value":"","external_name":"size","restriction":"Int64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if size >= 0\nelse\n  return false\nend\npre = SparseEntry.new(0, 0)\nsp.each_with_index do |cur, _|\n  case\n  when cur.offset < 0, cur.length < 0\n    return false\n  when cur.offset > (Int64::MAX - cur.length)\n    return false\n  when cur.end_of_offset > size\n    return false\n  when pre.end_of_offset > cur.offset\n    return false\n  end\n  pre = cur\nend\ntrue\n"}}],"macros":[],"types":[{"html_id":"github.com/naqvis/crystar/Crystar/Error","path":"Crystar/Error.html","kind":"class","full_name":"Crystar::Error","name":"Error","abstract":false,"superclass":{"html_id":"github.com/naqvis/crystar/Exception","kind":"class","full_name":"Exception","name":"Exception"},"ancestors":[{"html_id":"github.com/naqvis/crystar/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"github.com/naqvis/crystar/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/naqvis/crystar/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"crystar.cr","line_number":41,"url":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/crystar.cr"}],"repository_name":"github.com/naqvis/crystar","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[{"html_id":"github.com/naqvis/crystar/Crystar/ErrWriteTooLong","kind":"class","full_name":"Crystar::ErrWriteTooLong","name":"ErrWriteTooLong"}],"including_types":[],"namespace":{"html_id":"github.com/naqvis/crystar/Crystar","kind":"module","full_name":"Crystar","name":"Crystar"},"doc":"Common Crystar exceptions","summary":"<p>Common Crystar exceptions</p>","class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[]},{"html_id":"github.com/naqvis/crystar/Crystar/ErrWriteTooLong","path":"Crystar/ErrWriteTooLong.html","kind":"class","full_name":"Crystar::ErrWriteTooLong","name":"ErrWriteTooLong","abstract":false,"superclass":{"html_id":"github.com/naqvis/crystar/Crystar/Error","kind":"class","full_name":"Crystar::Error","name":"Error"},"ancestors":[{"html_id":"github.com/naqvis/crystar/Crystar/Error","kind":"class","full_name":"Crystar::Error","name":"Error"},{"html_id":"github.com/naqvis/crystar/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"github.com/naqvis/crystar/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/naqvis/crystar/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"crystar.cr","line_number":44,"url":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/crystar.cr"}],"repository_name":"github.com/naqvis/crystar","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/naqvis/crystar/Crystar","kind":"module","full_name":"Crystar","name":"Crystar"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[]},{"html_id":"github.com/naqvis/crystar/Crystar/Format","path":"Crystar/Format.html","kind":"enum","full_name":"Crystar::Format","name":"Format","abstract":false,"superclass":null,"ancestors":[{"html_id":"github.com/naqvis/crystar/Enum","kind":"struct","full_name":"Enum","name":"Enum"},{"html_id":"github.com/naqvis/crystar/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"github.com/naqvis/crystar/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"github.com/naqvis/crystar/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"tar/format.cr","line_number":44,"url":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/format.cr"}],"repository_name":"github.com/naqvis/crystar","program":false,"enum":true,"alias":false,"aliased":"","const":false,"constants":[{"id":"V7","name":"V7","value":"1","doc":"The format of the original Unix V7 tar tool prior to standardization.","summary":"<p>The format of the original Unix V7 tar tool prior to standardization.</p>"},{"id":"USTAR","name":"USTAR","value":"2","doc":"USTAR represents the USTAR header format defined in POSIX.1-1988.\n\nWhile this format is compatible with most tar readers,\nthe format has several limitations making it unsuitable for some usages.\nMost notably, it cannot support sparse files, files larger than 8GiB,\nfilenames larger than 256 characters, and non-ASCII filenames.\n\nReference:\n\thttp:#pubs.opengroup.org/onlinepubs/9699919799/utilities/pax.html#tag_20_92_13_06","summary":"<p>USTAR represents the USTAR header format defined in POSIX.1-1988.</p>"},{"id":"PAX","name":"PAX","value":"4","doc":"PAX represents the PAX header format defined in POSIX.1-2001.\n\nPAX extends USTAR by writing a special file with Typeflag TypeXHeader\npreceding the original header. This file contains a set of key-value\nrecords, which are used to overcome USTAR's shortcomings, in addition to\nproviding the ability to have sub-second resolution for timestamps.\n\nSome newer formats add their own extensions to PAX by defining their\nown keys and assigning certain semantic meaning to the associated values.\nFor example, sparse file support in PAX is implemented using keys\ndefined by the GNU manual (e.g., \"GNU.sparse.map\").\n\nReference:\n\thttp:#pubs.opengroup.org/onlinepubs/009695399/utilities/pax.html","summary":"<p>PAX represents the PAX header format defined in POSIX.1-2001.</p>"},{"id":"GNU","name":"GNU","value":"8","doc":"GNU represents the GNU header format.\n\nThe GNU header format is older than the USTAR and PAX standards and\nis not compatible with them. The GNU format supports\narbitrary file sizes, filenames of arbitrary encoding and length,\nsparse files, and other features.\n\nIt is recommended that PAX be chosen over GNU unless the target\napplication can only parse GNU formatted archives.\n\nReference:\n\thttps:#www.gnu.org/softwarecrystar/manual/html_node/Standard.html","summary":"<p>GNU represents the GNU header format.</p>"},{"id":"STAR","name":"STAR","value":"16","doc":"Schily's tar format, which is incompatible with USTAR.\nThis does not cover STAR extensions to the PAX format; these fall under\nthe PAX format.","summary":"<p>Schily's tar format, which is incompatible with USTAR.</p>"}],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/naqvis/crystar/Crystar","kind":"module","full_name":"Crystar","name":"Crystar"},"doc":"Various Crystar formats","summary":"<p>Various Crystar formats</p>","class_methods":[],"constructors":[],"instance_methods":[{"id":"gnu?-instance-method","html_id":"gnu?-instance-method","name":"gnu?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/format.cr#L84","def":{"name":"gnu?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self.includes?(GNU)"}},{"id":"has(f2:self)-instance-method","html_id":"has(f2:self)-instance-method","name":"has","doc":null,"summary":null,"abstract":false,"args":[{"name":"f2","doc":null,"default_value":"","external_name":"f2","restriction":"self"}],"args_string":"(f2 : <span class=\"k\">self</span>)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/format.cr#L90","def":{"name":"has","args":[{"name":"f2","doc":null,"default_value":"","external_name":"f2","restriction":"self"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"includes?(f2)"}},{"id":"may_only_be(f2)-instance-method","html_id":"may_only_be(f2)-instance-method","name":"may_only_be","doc":null,"summary":null,"abstract":false,"args":[{"name":"f2","doc":null,"default_value":"","external_name":"f2","restriction":""}],"args_string":"(f2)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/format.cr#L98","def":{"name":"may_only_be","args":[{"name":"f2","doc":null,"default_value":"","external_name":"f2","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self & f2"}},{"id":"maybe(f2:self)-instance-method","html_id":"maybe(f2:self)-instance-method","name":"maybe","doc":null,"summary":null,"abstract":false,"args":[{"name":"f2","doc":null,"default_value":"","external_name":"f2","restriction":"self"}],"args_string":"(f2 : <span class=\"k\">self</span>)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/format.cr#L94","def":{"name":"maybe","args":[{"name":"f2","doc":null,"default_value":"","external_name":"f2","restriction":"self"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self | f2"}},{"id":"must_not_be(f2)-instance-method","html_id":"must_not_be(f2)-instance-method","name":"must_not_be","doc":null,"summary":null,"abstract":false,"args":[{"name":"f2","doc":null,"default_value":"","external_name":"f2","restriction":""}],"args_string":"(f2)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/format.cr#L102","def":{"name":"must_not_be","args":[{"name":"f2","doc":null,"default_value":"","external_name":"f2","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self & (~f2)"}},{"id":"none?-instance-method","html_id":"none?-instance-method","name":"none?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/format.cr#L44","def":{"name":"none?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"value == 0"}},{"id":"pax?-instance-method","html_id":"pax?-instance-method","name":"pax?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/format.cr#L71","def":{"name":"pax?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self.includes?(PAX)"}},{"id":"star?-instance-method","html_id":"star?-instance-method","name":"star?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/format.cr#L88","def":{"name":"star?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self.includes?(STAR)"}},{"id":"ustar?-instance-method","html_id":"ustar?-instance-method","name":"ustar?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/format.cr#L56","def":{"name":"ustar?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self.includes?(USTAR)"}},{"id":"v7?-instance-method","html_id":"v7?-instance-method","name":"v7?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/format.cr#L46","def":{"name":"v7?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self.includes?(V7)"}}],"macros":[],"types":[]},{"html_id":"github.com/naqvis/crystar/Crystar/Header","path":"Crystar/Header.html","kind":"class","full_name":"Crystar::Header","name":"Header","abstract":false,"superclass":{"html_id":"github.com/naqvis/crystar/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"github.com/naqvis/crystar/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/naqvis/crystar/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"tar/header.cr","line_number":15,"url":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr"}],"repository_name":"github.com/naqvis/crystar","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/naqvis/crystar/Crystar","kind":"module","full_name":"Crystar","name":"Crystar"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(flag=0_u8,name=&quot;&quot;,link_name=&quot;&quot;,size=0_i64,mode=0_i64,uid=0,gid=0,uname=&quot;&quot;,gname=&quot;&quot;,mod_time=Crystar.unix_time(0,0),access_time=Crystar.unix_time(0,0),change_time=Crystar.unix_time(0,0),dev_major=0_i64,dev_minor=0_i64,xattr=Hash(String,String).new,pax_records=Hash(String,String).new,format=Format::None,io=IO::Memory.new)-class-method","html_id":"new(flag=0_u8,name=&amp;quot;&amp;quot;,link_name=&amp;quot;&amp;quot;,size=0_i64,mode=0_i64,uid=0,gid=0,uname=&amp;quot;&amp;quot;,gname=&amp;quot;&amp;quot;,mod_time=Crystar.unix_time(0,0),access_time=Crystar.unix_time(0,0),change_time=Crystar.unix_time(0,0),dev_major=0_i64,dev_minor=0_i64,xattr=Hash(String,String).new,pax_records=Hash(String,String).new,format=Format::None,io=IO::Memory.new)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"flag","doc":null,"default_value":"0_u8","external_name":"flag","restriction":""},{"name":"name","doc":null,"default_value":"\"\"","external_name":"name","restriction":""},{"name":"link_name","doc":null,"default_value":"\"\"","external_name":"link_name","restriction":""},{"name":"size","doc":null,"default_value":"0_i64","external_name":"size","restriction":""},{"name":"mode","doc":null,"default_value":"0_i64","external_name":"mode","restriction":""},{"name":"uid","doc":null,"default_value":"0","external_name":"uid","restriction":""},{"name":"gid","doc":null,"default_value":"0","external_name":"gid","restriction":""},{"name":"uname","doc":null,"default_value":"\"\"","external_name":"uname","restriction":""},{"name":"gname","doc":null,"default_value":"\"\"","external_name":"gname","restriction":""},{"name":"mod_time","doc":null,"default_value":"Crystar.unix_time(0, 0)","external_name":"mod_time","restriction":""},{"name":"access_time","doc":null,"default_value":"Crystar.unix_time(0, 0)","external_name":"access_time","restriction":""},{"name":"change_time","doc":null,"default_value":"Crystar.unix_time(0, 0)","external_name":"change_time","restriction":""},{"name":"dev_major","doc":null,"default_value":"0_i64","external_name":"dev_major","restriction":""},{"name":"dev_minor","doc":null,"default_value":"0_i64","external_name":"dev_minor","restriction":""},{"name":"xattr","doc":null,"default_value":"Hash(String, String).new","external_name":"xattr","restriction":""},{"name":"pax_records","doc":null,"default_value":"Hash(String, String).new","external_name":"pax_records","restriction":""},{"name":"format","doc":null,"default_value":"Format::None","external_name":"format","restriction":""},{"name":"io","doc":null,"default_value":"IO::Memory.new","external_name":"io","restriction":""}],"args_string":"(flag = <span class=\"n\">0_u8</span>, name = <span class=\"s\">&quot;&quot;</span>, link_name = <span class=\"s\">&quot;&quot;</span>, size = <span class=\"n\">0_i64</span>, mode = <span class=\"n\">0_i64</span>, uid = <span class=\"n\">0</span>, gid = <span class=\"n\">0</span>, uname = <span class=\"s\">&quot;&quot;</span>, gname = <span class=\"s\">&quot;&quot;</span>, mod_time = <span class=\"t\">Crystar</span>.unix_time(<span class=\"n\">0</span>, <span class=\"n\">0</span>), access_time = <span class=\"t\">Crystar</span>.unix_time(<span class=\"n\">0</span>, <span class=\"n\">0</span>), change_time = <span class=\"t\">Crystar</span>.unix_time(<span class=\"n\">0</span>, <span class=\"n\">0</span>), dev_major = <span class=\"n\">0_i64</span>, dev_minor = <span class=\"n\">0_i64</span>, xattr = <span class=\"t\">Hash</span>(<span class=\"t\">String</span>, <span class=\"t\">String</span>).<span class=\"k\">new</span>, pax_records = <span class=\"t\">Hash</span>(<span class=\"t\">String</span>, <span class=\"t\">String</span>).<span class=\"k\">new</span>, format = <span class=\"t\">Format</span><span class=\"t\">::</span><span class=\"t\">None</span>, io = <span class=\"t\">IO</span><span class=\"t\">::</span><span class=\"t\">Memory</span>.<span class=\"k\">new</span>)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L81","def":{"name":"new","args":[{"name":"flag","doc":null,"default_value":"0_u8","external_name":"flag","restriction":""},{"name":"name","doc":null,"default_value":"\"\"","external_name":"name","restriction":""},{"name":"link_name","doc":null,"default_value":"\"\"","external_name":"link_name","restriction":""},{"name":"size","doc":null,"default_value":"0_i64","external_name":"size","restriction":""},{"name":"mode","doc":null,"default_value":"0_i64","external_name":"mode","restriction":""},{"name":"uid","doc":null,"default_value":"0","external_name":"uid","restriction":""},{"name":"gid","doc":null,"default_value":"0","external_name":"gid","restriction":""},{"name":"uname","doc":null,"default_value":"\"\"","external_name":"uname","restriction":""},{"name":"gname","doc":null,"default_value":"\"\"","external_name":"gname","restriction":""},{"name":"mod_time","doc":null,"default_value":"Crystar.unix_time(0, 0)","external_name":"mod_time","restriction":""},{"name":"access_time","doc":null,"default_value":"Crystar.unix_time(0, 0)","external_name":"access_time","restriction":""},{"name":"change_time","doc":null,"default_value":"Crystar.unix_time(0, 0)","external_name":"change_time","restriction":""},{"name":"dev_major","doc":null,"default_value":"0_i64","external_name":"dev_major","restriction":""},{"name":"dev_minor","doc":null,"default_value":"0_i64","external_name":"dev_minor","restriction":""},{"name":"xattr","doc":null,"default_value":"Hash(String, String).new","external_name":"xattr","restriction":""},{"name":"pax_records","doc":null,"default_value":"Hash(String, String).new","external_name":"pax_records","restriction":""},{"name":"format","doc":null,"default_value":"Format::None","external_name":"format","restriction":""},{"name":"io","doc":null,"default_value":"IO::Memory.new","external_name":"io","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(flag, name, link_name, size, mode, uid, gid, uname, gname, mod_time, access_time, change_time, dev_major, dev_minor, xattr, pax_records, format, io)\nif _.responds_to?(:finalize)\n  ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"==(other:self)-instance-method","html_id":"==(other:self)-instance-method","name":"==","doc":null,"summary":null,"abstract":false,"args":[{"name":"other","doc":null,"default_value":"","external_name":"other","restriction":"self"}],"args_string":"(other : <span class=\"k\">self</span>)","source_link":null,"def":{"name":"==","args":[{"name":"other","doc":null,"default_value":"","external_name":"other","restriction":"self"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if @flag == (other.@flag)\nelse\n  return false\nend\nif @name == (other.@name)\nelse\n  return false\nend\nif @link_name == (other.@link_name)\nelse\n  return false\nend\nif @size == (other.@size)\nelse\n  return false\nend\nif @mode == (other.@mode)\nelse\n  return false\nend\nif @gid == (other.@gid)\nelse\n  return false\nend\nif @uname == (other.@uname)\nelse\n  return false\nend\nif @gname == (other.@gname)\nelse\n  return false\nend\nif @mod_time == (other.@mod_time)\nelse\n  return false\nend\nif @access_time == (other.@access_time)\nelse\n  return false\nend\nif @change_time == (other.@change_time)\nelse\n  return false\nend\nif @dev_major == (other.@dev_major)\nelse\n  return false\nend\nif @dev_minor == (other.@dev_minor)\nelse\n  return false\nend\nif @xattr == (other.@xattr)\nelse\n  return false\nend\nif @pax_records == (other.@pax_records)\nelse\n  return false\nend\nif @format == (other.@format)\nelse\n  return false\nend\ntrue\n"}},{"id":"access_time:Time-instance-method","html_id":"access_time:Time-instance-method","name":"access_time","doc":"Modification time","summary":"<p>Modification time</p>","abstract":false,"args":[],"args_string":" : Time","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L38","def":{"name":"access_time","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Time","visibility":"Public","body":"@access_time"}},{"id":"access_time=(access_time:Time)-instance-method","html_id":"access_time=(access_time:Time)-instance-method","name":"access_time=","doc":"Modification time","summary":"<p>Modification time</p>","abstract":false,"args":[{"name":"access_time","doc":null,"default_value":"","external_name":"access_time","restriction":"Time"}],"args_string":"(access_time : Time)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L42","def":{"name":"access_time=","args":[{"name":"access_time","doc":null,"default_value":"","external_name":"access_time","restriction":"Time"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@access_time = access_time"}},{"id":"change_time:Time-instance-method","html_id":"change_time:Time-instance-method","name":"change_time","doc":"Access time (requires either PAX or GNU support)","summary":"<p>Access time (requires either PAX or GNU support)</p>","abstract":false,"args":[],"args_string":" : Time","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L39","def":{"name":"change_time","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Time","visibility":"Public","body":"@change_time"}},{"id":"change_time=(change_time:Time)-instance-method","html_id":"change_time=(change_time:Time)-instance-method","name":"change_time=","doc":"Access time (requires either PAX or GNU support)","summary":"<p>Access time (requires either PAX or GNU support)</p>","abstract":false,"args":[{"name":"change_time","doc":null,"default_value":"","external_name":"change_time","restriction":"Time"}],"args_string":"(change_time : Time)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L43","def":{"name":"change_time=","args":[{"name":"change_time","doc":null,"default_value":"","external_name":"change_time","restriction":"Time"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@change_time = change_time"}},{"id":"dev_major:Int64-instance-method","html_id":"dev_major:Int64-instance-method","name":"dev_major","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int64","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L41","def":{"name":"dev_major","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int64","visibility":"Public","body":"@dev_major"}},{"id":"dev_major=(dev_major:Int64)-instance-method","html_id":"dev_major=(dev_major:Int64)-instance-method","name":"dev_major=","doc":null,"summary":null,"abstract":false,"args":[{"name":"dev_major","doc":null,"default_value":"","external_name":"dev_major","restriction":"Int64"}],"args_string":"(dev_major : Int64)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L45","def":{"name":"dev_major=","args":[{"name":"dev_major","doc":null,"default_value":"","external_name":"dev_major","restriction":"Int64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@dev_major = dev_major"}},{"id":"dev_minor:Int64-instance-method","html_id":"dev_minor:Int64-instance-method","name":"dev_minor","doc":"Major device number (valid for CHAR or BLOCK)","summary":"<p>Major device number (valid for CHAR or BLOCK)</p>","abstract":false,"args":[],"args_string":" : Int64","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L42","def":{"name":"dev_minor","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int64","visibility":"Public","body":"@dev_minor"}},{"id":"dev_minor=(dev_minor:Int64)-instance-method","html_id":"dev_minor=(dev_minor:Int64)-instance-method","name":"dev_minor=","doc":"Major device number (valid for CHAR or BLOCK)","summary":"<p>Major device number (valid for CHAR or BLOCK)</p>","abstract":false,"args":[{"name":"dev_minor","doc":null,"default_value":"","external_name":"dev_minor","restriction":"Int64"}],"args_string":"(dev_minor : Int64)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L46","def":{"name":"dev_minor=","args":[{"name":"dev_minor","doc":null,"default_value":"","external_name":"dev_minor","restriction":"Int64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@dev_minor = dev_minor"}},{"id":"file_info-instance-method","html_id":"file_info-instance-method","name":"file_info","doc":"file_info returns an File::Info for the header","summary":"<p>file_info returns an File::Info for the header</p>","abstract":false,"args":[],"args_string":"","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L296","def":{"name":"file_info","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"HeaderFileInfo.new(self)"}},{"id":"flag:UInt8-instance-method","html_id":"flag:UInt8-instance-method","name":"flag","doc":"Typeflag is the type of header entry.\nThe zero value is automatically promoted to either TypeReg or TypeDir\ndepending on the presence of a trailing slash in Name.","summary":"<p>Typeflag is the type of header entry.</p>","abstract":false,"args":[],"args_string":" : UInt8","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L21","def":{"name":"flag","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"UInt8","visibility":"Public","body":"@flag"}},{"id":"flag=(flag:UInt8)-instance-method","html_id":"flag=(flag:UInt8)-instance-method","name":"flag=","doc":"Typeflag is the type of header entry.\nThe zero value is automatically promoted to either TypeReg or TypeDir\ndepending on the presence of a trailing slash in Name.","summary":"<p>Typeflag is the type of header entry.</p>","abstract":false,"args":[{"name":"flag","doc":null,"default_value":"","external_name":"flag","restriction":"UInt8"}],"args_string":"(flag : UInt8)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L25","def":{"name":"flag=","args":[{"name":"flag","doc":null,"default_value":"","external_name":"flag","restriction":"UInt8"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@flag = flag"}},{"id":"flag=(v:Int)-instance-method","html_id":"flag=(v:Int)-instance-method","name":"flag=","doc":null,"summary":null,"abstract":false,"args":[{"name":"v","doc":null,"default_value":"","external_name":"v","restriction":"Int"}],"args_string":"(v : Int)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L102","def":{"name":"flag=","args":[{"name":"v","doc":null,"default_value":"","external_name":"v","restriction":"Int"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@flag = v.to_u8"}},{"id":"format:Format-instance-method","html_id":"format:Format-instance-method","name":"format","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Format","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L79","def":{"name":"format","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Format","visibility":"Public","body":"@format"}},{"id":"format=(format:Format)-instance-method","html_id":"format=(format:Format)-instance-method","name":"format=","doc":null,"summary":null,"abstract":false,"args":[{"name":"format","doc":null,"default_value":"","external_name":"format","restriction":"Format"}],"args_string":"(format : Format)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L83","def":{"name":"format=","args":[{"name":"format","doc":null,"default_value":"","external_name":"format","restriction":"Format"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@format = format"}},{"id":"gid:Int32-instance-method","html_id":"gid:Int32-instance-method","name":"gid","doc":"User ID of owner","summary":"<p>User ID of owner</p>","abstract":false,"args":[],"args_string":" : Int32","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L28","def":{"name":"gid","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int32","visibility":"Public","body":"@gid"}},{"id":"gid=(gid:Int32)-instance-method","html_id":"gid=(gid:Int32)-instance-method","name":"gid=","doc":"User ID of owner","summary":"<p>User ID of owner</p>","abstract":false,"args":[{"name":"gid","doc":null,"default_value":"","external_name":"gid","restriction":"Int32"}],"args_string":"(gid : Int32)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L32","def":{"name":"gid=","args":[{"name":"gid","doc":null,"default_value":"","external_name":"gid","restriction":"Int32"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@gid = gid"}},{"id":"gid=(v:Int)-instance-method","html_id":"gid=(v:Int)-instance-method","name":"gid=","doc":null,"summary":null,"abstract":false,"args":[{"name":"v","doc":null,"default_value":"","external_name":"v","restriction":"Int"}],"args_string":"(v : Int)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L98","def":{"name":"gid=","args":[{"name":"v","doc":null,"default_value":"","external_name":"v","restriction":"Int"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@gid = v.to_i32"}},{"id":"gname:String-instance-method","html_id":"gname:String-instance-method","name":"gname","doc":"User name of owner","summary":"<p>User name of owner</p>","abstract":false,"args":[],"args_string":" : String","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L30","def":{"name":"gname","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@gname"}},{"id":"gname=(gname:String)-instance-method","html_id":"gname=(gname:String)-instance-method","name":"gname=","doc":"User name of owner","summary":"<p>User name of owner</p>","abstract":false,"args":[{"name":"gname","doc":null,"default_value":"","external_name":"gname","restriction":"String"}],"args_string":"(gname : String)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L34","def":{"name":"gname=","args":[{"name":"gname","doc":null,"default_value":"","external_name":"gname","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@gname = gname"}},{"id":"hash(hasher)-instance-method","html_id":"hash(hasher)-instance-method","name":"hash","doc":null,"summary":null,"abstract":false,"args":[{"name":"hasher","doc":null,"default_value":"","external_name":"hasher","restriction":""}],"args_string":"(hasher)","source_link":null,"def":{"name":"hash","args":[{"name":"hasher","doc":null,"default_value":"","external_name":"hasher","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"hasher = @flag.hash(hasher)\nhasher = @name.hash(hasher)\nhasher = @link_name.hash(hasher)\nhasher = @size.hash(hasher)\nhasher = @mode.hash(hasher)\nhasher = @gid.hash(hasher)\nhasher = @uname.hash(hasher)\nhasher = @gname.hash(hasher)\nhasher = @mod_time.hash(hasher)\nhasher = @access_time.hash(hasher)\nhasher = @change_time.hash(hasher)\nhasher = @dev_major.hash(hasher)\nhasher = @dev_minor.hash(hasher)\nhasher = @xattr.hash(hasher)\nhasher = @pax_records.hash(hasher)\nhasher = @format.hash(hasher)\nhasher\n"}},{"id":"io:IO-instance-method","html_id":"io:IO-instance-method","name":"io","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : IO","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L81","def":{"name":"io","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"IO","visibility":"Public","body":"@io"}},{"id":"link_name:String-instance-method","html_id":"link_name:String-instance-method","name":"link_name","doc":"Name of file entry","summary":"<p>Name of file entry</p>","abstract":false,"args":[],"args_string":" : String","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L23","def":{"name":"link_name","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@link_name"}},{"id":"link_name=(link_name:String)-instance-method","html_id":"link_name=(link_name:String)-instance-method","name":"link_name=","doc":"Name of file entry","summary":"<p>Name of file entry</p>","abstract":false,"args":[{"name":"link_name","doc":null,"default_value":"","external_name":"link_name","restriction":"String"}],"args_string":"(link_name : String)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L27","def":{"name":"link_name=","args":[{"name":"link_name","doc":null,"default_value":"","external_name":"link_name","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@link_name = link_name"}},{"id":"mod_time:Time-instance-method","html_id":"mod_time:Time-instance-method","name":"mod_time","doc":"If the Format is unspecified, then Writer.WriteHeader rounds ModTime\nto the nearest second and ignores the AccessTime and ChangeTime fields.\n\nTo use AccessTime or ChangeTime, specify the Format as PAX or GNU.\nTo use sub-second resolution, specify the Format as PAX.","summary":"<p>If the Format is unspecified, then Writer.WriteHeader rounds ModTime to the nearest second and ignores the AccessTime and ChangeTime fields.</p>","abstract":false,"args":[],"args_string":" : Time","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L37","def":{"name":"mod_time","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Time","visibility":"Public","body":"@mod_time"}},{"id":"mod_time=(mod_time:Time)-instance-method","html_id":"mod_time=(mod_time:Time)-instance-method","name":"mod_time=","doc":"If the Format is unspecified, then Writer.WriteHeader rounds ModTime\nto the nearest second and ignores the AccessTime and ChangeTime fields.\n\nTo use AccessTime or ChangeTime, specify the Format as PAX or GNU.\nTo use sub-second resolution, specify the Format as PAX.","summary":"<p>If the Format is unspecified, then Writer.WriteHeader rounds ModTime to the nearest second and ignores the AccessTime and ChangeTime fields.</p>","abstract":false,"args":[{"name":"mod_time","doc":null,"default_value":"","external_name":"mod_time","restriction":"Time"}],"args_string":"(mod_time : Time)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L41","def":{"name":"mod_time=","args":[{"name":"mod_time","doc":null,"default_value":"","external_name":"mod_time","restriction":"Time"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@mod_time = mod_time"}},{"id":"mode:Int64-instance-method","html_id":"mode:Int64-instance-method","name":"mode","doc":"Logical file size in bytes","summary":"<p>Logical file size in bytes</p>","abstract":false,"args":[],"args_string":" : Int64","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L26","def":{"name":"mode","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int64","visibility":"Public","body":"@mode"}},{"id":"mode=(mode:Int64)-instance-method","html_id":"mode=(mode:Int64)-instance-method","name":"mode=","doc":"Logical file size in bytes","summary":"<p>Logical file size in bytes</p>","abstract":false,"args":[{"name":"mode","doc":null,"default_value":"","external_name":"mode","restriction":"Int64"}],"args_string":"(mode : Int64)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L30","def":{"name":"mode=","args":[{"name":"mode","doc":null,"default_value":"","external_name":"mode","restriction":"Int64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@mode = mode"}},{"id":"name:String-instance-method","html_id":"name:String-instance-method","name":"name","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L22","def":{"name":"name","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@name"}},{"id":"name=(name:String)-instance-method","html_id":"name=(name:String)-instance-method","name":"name=","doc":null,"summary":null,"abstract":false,"args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":"String"}],"args_string":"(name : String)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L26","def":{"name":"name=","args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@name = name"}},{"id":"pax_records:Hash(String,String)-instance-method","html_id":"pax_records:Hash(String,String)-instance-method","name":"pax_records","doc":"PAXRecords is a map of PAX extended header records.\n\nUser-defined records should have keys of the following form:\n\tVENDOR.keyword\nWhere VENDOR is some namespace in all uppercase, and keyword may\nnot contain the '=' character (e.g., \"GOLANG.pkg.version\").\nThe key and value should be non-empty UTF-8 strings.\n\nWhen Writer.WriteHeader is called, PAX records derived from the\nother fields in Header take precedence over PAXRecords.","summary":"<p>PAXRecords is a map of PAX extended header records.</p>","abstract":false,"args":[],"args_string":" : Hash(String, String)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L67","def":{"name":"pax_records","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Hash(String, String)","visibility":"Public","body":"@pax_records"}},{"id":"pax_records=(pax_records:Hash(String,String))-instance-method","html_id":"pax_records=(pax_records:Hash(String,String))-instance-method","name":"pax_records=","doc":"PAXRecords is a map of PAX extended header records.\n\nUser-defined records should have keys of the following form:\n\tVENDOR.keyword\nWhere VENDOR is some namespace in all uppercase, and keyword may\nnot contain the '=' character (e.g., \"GOLANG.pkg.version\").\nThe key and value should be non-empty UTF-8 strings.\n\nWhen Writer.WriteHeader is called, PAX records derived from the\nother fields in Header take precedence over PAXRecords.","summary":"<p>PAXRecords is a map of PAX extended header records.</p>","abstract":false,"args":[{"name":"pax_records","doc":null,"default_value":"","external_name":"pax_records","restriction":"Hash(String, String)"}],"args_string":"(pax_records : Hash(String, String))","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L71","def":{"name":"pax_records=","args":[{"name":"pax_records","doc":null,"default_value":"","external_name":"pax_records","restriction":"Hash(String, String)"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@pax_records = pax_records"}},{"id":"size:Int64-instance-method","html_id":"size:Int64-instance-method","name":"size","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int64","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L25","def":{"name":"size","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int64","visibility":"Public","body":"@size"}},{"id":"size=(size:Int64)-instance-method","html_id":"size=(size:Int64)-instance-method","name":"size=","doc":null,"summary":null,"abstract":false,"args":[{"name":"size","doc":null,"default_value":"","external_name":"size","restriction":"Int64"}],"args_string":"(size : Int64)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L29","def":{"name":"size=","args":[{"name":"size","doc":null,"default_value":"","external_name":"size","restriction":"Int64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@size = size"}},{"id":"size=(v:Int)-instance-method","html_id":"size=(v:Int)-instance-method","name":"size=","doc":null,"summary":null,"abstract":false,"args":[{"name":"v","doc":null,"default_value":"","external_name":"v","restriction":"Int"}],"args_string":"(v : Int)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L90","def":{"name":"size=","args":[{"name":"v","doc":null,"default_value":"","external_name":"v","restriction":"Int"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@size = v.to_i64"}},{"id":"uid:Int32-instance-method","html_id":"uid:Int32-instance-method","name":"uid","doc":"Permission and mode bits","summary":"<p>Permission and mode bits</p>","abstract":false,"args":[],"args_string":" : Int32","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L27","def":{"name":"uid","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int32","visibility":"Public","body":"@uid"}},{"id":"uid=(v:Int)-instance-method","html_id":"uid=(v:Int)-instance-method","name":"uid=","doc":null,"summary":null,"abstract":false,"args":[{"name":"v","doc":null,"default_value":"","external_name":"v","restriction":"Int"}],"args_string":"(v : Int)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L94","def":{"name":"uid=","args":[{"name":"v","doc":null,"default_value":"","external_name":"v","restriction":"Int"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@uid = v.to_i32"}},{"id":"uid=(uid:Int32)-instance-method","html_id":"uid=(uid:Int32)-instance-method","name":"uid=","doc":"Permission and mode bits","summary":"<p>Permission and mode bits</p>","abstract":false,"args":[{"name":"uid","doc":null,"default_value":"","external_name":"uid","restriction":"Int32"}],"args_string":"(uid : Int32)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L31","def":{"name":"uid=","args":[{"name":"uid","doc":null,"default_value":"","external_name":"uid","restriction":"Int32"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@uid = uid"}},{"id":"uname:String-instance-method","html_id":"uname:String-instance-method","name":"uname","doc":"Group ID of owner","summary":"<p>Group ID of owner</p>","abstract":false,"args":[],"args_string":" : String","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L29","def":{"name":"uname","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@uname"}},{"id":"uname=(uname:String)-instance-method","html_id":"uname=(uname:String)-instance-method","name":"uname=","doc":"Group ID of owner","summary":"<p>Group ID of owner</p>","abstract":false,"args":[{"name":"uname","doc":null,"default_value":"","external_name":"uname","restriction":"String"}],"args_string":"(uname : String)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L33","def":{"name":"uname=","args":[{"name":"uname","doc":null,"default_value":"","external_name":"uname","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@uname = uname"}},{"id":"xattr:Hash(String,String)-instance-method","html_id":"xattr:Hash(String,String)-instance-method","name":"xattr","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Hash(String, String)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L55","def":{"name":"xattr","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Hash(String, String)","visibility":"Public","body":"@xattr"}},{"id":"xattr=(xattr:Hash(String,String))-instance-method","html_id":"xattr=(xattr:Hash(String,String))-instance-method","name":"xattr=","doc":null,"summary":null,"abstract":false,"args":[{"name":"xattr","doc":null,"default_value":"","external_name":"xattr","restriction":"Hash(String, String)"}],"args_string":"(xattr : Hash(String, String))","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L59","def":{"name":"xattr=","args":[{"name":"xattr","doc":null,"default_value":"","external_name":"xattr","restriction":"Hash(String, String)"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@xattr = xattr"}}],"macros":[],"types":[]},{"html_id":"github.com/naqvis/crystar/Crystar/Reader","path":"Crystar/Reader.html","kind":"class","full_name":"Crystar::Reader","name":"Reader","abstract":false,"superclass":{"html_id":"github.com/naqvis/crystar/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"github.com/naqvis/crystar/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/naqvis/crystar/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"tar/reader.cr","line_number":23,"url":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/reader.cr"}],"repository_name":"github.com/naqvis/crystar","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/naqvis/crystar/Crystar","kind":"module","full_name":"Crystar","name":"Crystar"},"doc":"Reads tar file entries sequentially from an `IO`.\n\n### Example\n\n```\nrequire \"tar\"\n\nFile.open(\"./file.tar\") do |file|\n  Crystar::Reader.open(file) do |tar|\n    tar.each_entry do |entry|\n      p entry.name\n      p entry.file?\n      p entry.dir?\n      p entry.io.gets_to_end\n    end\n  end\nend\n```","summary":"<p>Reads tar file entries sequentially from an <code>IO</code>.</p>","class_methods":[{"id":"open(io:IO,sync_close=false,&block)-class-method","html_id":"open(io:IO,sync_close=false,&amp;block)-class-method","name":"open","doc":"Creates a new reader from the given *io*, yields it to the given block,\nand closes it at the end.","summary":"<p>Creates a new reader from the given <em>io</em>, yields it to the given block, and closes it at the end.</p>","abstract":false,"args":[{"name":"io","doc":null,"default_value":"","external_name":"io","restriction":"IO"},{"name":"sync_close","doc":null,"default_value":"false","external_name":"sync_close","restriction":""}],"args_string":"(io : IO, sync_close = <span class=\"n\">false</span>, &block)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/reader.cr#L47","def":{"name":"open","args":[{"name":"io","doc":null,"default_value":"","external_name":"io","restriction":"IO"},{"name":"sync_close","doc":null,"default_value":"false","external_name":"sync_close","restriction":""}],"double_splat":null,"splat_index":null,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"reader = new(io, sync_close: sync_close)\nbegin\n  yield reader\nensure\n  reader.close\nend\n"}},{"id":"open(filename:String,&block)-class-method","html_id":"open(filename:String,&amp;block)-class-method","name":"open","doc":"Creates a new reader from the given *filename*, yields it to the given block,\nand closes it at the end.","summary":"<p>Creates a new reader from the given <em>filename</em>, yields it to the given block, and closes it at the end.</p>","abstract":false,"args":[{"name":"filename","doc":null,"default_value":"","external_name":"filename","restriction":"String"}],"args_string":"(filename : String, &block)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/reader.cr#L54","def":{"name":"open","args":[{"name":"filename","doc":null,"default_value":"","external_name":"filename","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"reader = new(filename)\nbegin\n  yield reader\nensure\n  reader.close\nend\n"}}],"constructors":[{"id":"new(io:IO,sync_close=false)-class-method","html_id":"new(io:IO,sync_close=false)-class-method","name":"new","doc":"Creates a new reader from the given *io*.","summary":"<p>Creates a new reader from the given <em>io</em>.</p>","abstract":false,"args":[{"name":"io","doc":null,"default_value":"","external_name":"io","restriction":"IO"},{"name":"sync_close","doc":null,"default_value":"false","external_name":"sync_close","restriction":""}],"args_string":"(io : IO, sync_close = <span class=\"n\">false</span>)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/reader.cr#L35","def":{"name":"new","args":[{"name":"io","doc":null,"default_value":"","external_name":"io","restriction":"IO"},{"name":"sync_close","doc":null,"default_value":"false","external_name":"sync_close","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(io, sync_close)\nif _.responds_to?(:finalize)\n  ::GC.add_finalizer(_)\nend\n_\n"}},{"id":"new(filename:String)-class-method","html_id":"new(filename:String)-class-method","name":"new","doc":"Creates a new reader from the given *filename*.","summary":"<p>Creates a new reader from the given <em>filename</em>.</p>","abstract":false,"args":[{"name":"filename","doc":null,"default_value":"","external_name":"filename","restriction":"String"}],"args_string":"(filename : String)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/reader.cr#L41","def":{"name":"new","args":[{"name":"filename","doc":null,"default_value":"","external_name":"filename","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new(::File.new(filename), sync_close: true)"}}],"instance_methods":[{"id":"close-instance-method","html_id":"close-instance-method","name":"close","doc":"Closes Crystar reader","summary":"<p>Closes Crystar reader</p>","abstract":false,"args":[],"args_string":"","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/reader.cr#L67","def":{"name":"close","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if @closed\n  return\nend\n@closed = true\nif @sync_close\n  @io.close\nend\n"}},{"id":"closed?:Bool-instance-method","html_id":"closed?:Bool-instance-method","name":"closed?","doc":"Returns `true` if this reader is closed.","summary":"<p>Returns <code>true</code> if this reader is closed.</p>","abstract":false,"args":[],"args_string":" : Bool","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/reader.cr#L30","def":{"name":"closed?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@closed"}},{"id":"each_entry(&block)-instance-method","html_id":"each_entry(&amp;block)-instance-method","name":"each_entry","doc":"Yields each entry in the zip to the given block.","summary":"<p>Yields each entry in the zip to the given block.</p>","abstract":false,"args":[],"args_string":"(&block)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/reader.cr#L60","def":{"name":"each_entry","args":[],"double_splat":null,"splat_index":null,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"while entry = next_entry\n  yield entry\nend"}},{"id":"next_entry:Header?-instance-method","html_id":"next_entry:Header?-instance-method","name":"next_entry","doc":"next_entry advances to the next entry in the tar archive.\nThe Header.Size determines how many bytes can be read for the next file.\nAny remaining data in the current file is automatically discarded.\n\nEOF is returned at the end of the input.","summary":"<p>next_entry advances to the next entry in the tar archive.</p>","abstract":false,"args":[],"args_string":" : Header?","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/reader.cr#L78","def":{"name":"next_entry","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Header | ::Nil","visibility":"Public","body":"pax_hdrs = {} of String => String\ngnu_long_name = gnu_long_link = \"\"\nformat = Format.flags(USTAR, PAX, GNU)\nwhile true\n  @io.skip(@curr.physical_remaining)\n  @io.read_fully?(@block[...@pad])\n  @pad = 0\n  hdr, raw_hdr, err = read_header\n  if (err == 0) || hdr.nil?\n    return nil\n  end\n  if raw_hdr.nil?\n    return nil\n  end\n  handle_regular_file(hdr)\n  format = format.may_only_be(hdr.format)\n  case hdr.flag.chr\n  when XHEADER, XGLOBAL_HEADER\n    format = format.may_only_be(Format::PAX)\n    pax_hdrs = Crystar.parse_pax(@curr)\n    if hdr.flag.chr == XGLOBAL_HEADER\n      Crystar.merge_pax(hdr, pax_hdrs)\n      return Header.new(name: hdr.name, flag: hdr.flag, xattr: hdr.xattr, pax_records: hdr.pax_records, format: format, io: @curr)\n    end\n    next\n  when GNU_LONGNAME, GNU_LONGLINK\n    format = format.may_only_be(Format::GNU)\n    realname = @curr.gets_to_end.to_slice\n    p = Parser.new\n    case hdr.flag.chr\n    when GNU_LONGNAME\n      gnu_long_name = p.parse_string(realname)\n    when GNU_LONGLINK\n      gnu_long_link = p.parse_string(realname)\n    end\n    next\n  else\n    Crystar.merge_pax(hdr, pax_hdrs)\n    if !gnu_long_name.blank?\n      hdr.name = gnu_long_name\n    end\n    if !gnu_long_link.blank?\n      hdr.link_name = gnu_long_link\n    end\n    if hdr.flag == REG\n      if hdr.name.ends_with?(\"/\")\n        hdr.flag = DIR.ord\n      else\n        hdr.flag = REG.ord\n      end\n    end\n    handle_regular_file(hdr)\n    handle_sparse_file(hdr, raw_hdr)\n    if format.ustar? && format.pax?\n      format = format.may_only_be(Format::USTAR)\n    end\n    hdr.format = format\n    hdr.io = @curr\n    return hdr\n  end\nend\n"}},{"id":"sync_close=(sync_close)-instance-method","html_id":"sync_close=(sync_close)-instance-method","name":"sync_close=","doc":"Whether to close the enclosed `IO` when closing this reader.","summary":"<p>Whether to close the enclosed <code>IO</code> when closing this reader.</p>","abstract":false,"args":[{"name":"sync_close","doc":null,"default_value":"","external_name":"sync_close","restriction":""}],"args_string":"(sync_close)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/reader.cr#L31","def":{"name":"sync_close=","args":[{"name":"sync_close","doc":null,"default_value":"","external_name":"sync_close","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@sync_close = sync_close"}},{"id":"sync_close?:Bool-instance-method","html_id":"sync_close?:Bool-instance-method","name":"sync_close?","doc":"Whether to close the enclosed `IO` when closing this reader.","summary":"<p>Whether to close the enclosed <code>IO</code> when closing this reader.</p>","abstract":false,"args":[],"args_string":" : Bool","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/reader.cr#L27","def":{"name":"sync_close?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@sync_close"}}],"macros":[],"types":[{"html_id":"github.com/naqvis/crystar/Crystar/Reader/FileReader","path":"Crystar/Reader/FileReader.html","kind":"class","full_name":"Crystar::Reader::FileReader","name":"FileReader","abstract":true,"superclass":{"html_id":"github.com/naqvis/crystar/IO","kind":"class","full_name":"IO","name":"IO"},"ancestors":[{"html_id":"github.com/naqvis/crystar/Crystar/FileState","kind":"module","full_name":"Crystar::FileState","name":"FileState"},{"html_id":"github.com/naqvis/crystar/IO","kind":"class","full_name":"IO","name":"IO"},{"html_id":"github.com/naqvis/crystar/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/naqvis/crystar/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"tar/reader.cr","line_number":358,"url":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/reader.cr"}],"repository_name":"github.com/naqvis/crystar","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[{"html_id":"github.com/naqvis/crystar/Crystar/FileState","kind":"module","full_name":"Crystar::FileState","name":"FileState"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/naqvis/crystar/Crystar/Reader","kind":"class","full_name":"Crystar::Reader","name":"Reader"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(io)-class-method","html_id":"new(io)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"io","doc":null,"default_value":"","external_name":"io","restriction":""}],"args_string":"(io)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/reader.cr#L362","def":{"name":"new","args":[{"name":"io","doc":null,"default_value":"","external_name":"io","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(io)\nif _.responds_to?(:finalize)\n  ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"io:IO-instance-method","html_id":"io:IO-instance-method","name":"io","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : IO","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/reader.cr#L362","def":{"name":"io","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"IO","visibility":"Public","body":"@io"}},{"id":"read(b:Bytes):Int-instance-method","html_id":"read(b:Bytes):Int-instance-method","name":"read","doc":null,"summary":null,"abstract":true,"args":[{"name":"b","doc":null,"default_value":"","external_name":"b","restriction":"Bytes"}],"args_string":"(b : Bytes) : Int","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/reader.cr#L365","def":{"name":"read","args":[{"name":"b","doc":null,"default_value":"","external_name":"b","restriction":"Bytes"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int","visibility":"Public","body":""}},{"id":"write(b:Bytes)-instance-method","html_id":"write(b:Bytes)-instance-method","name":"write","doc":null,"summary":null,"abstract":false,"args":[{"name":"b","doc":null,"default_value":"","external_name":"b","restriction":"Bytes"}],"args_string":"(b : Bytes)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/reader.cr#L368","def":{"name":"write","args":[{"name":"b","doc":null,"default_value":"","external_name":"b","restriction":"Bytes"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"raise(Error.new(\"Crystar Reader: Can't write\"))"}},{"id":"write_to(w:IO):Int-instance-method","html_id":"write_to(w:IO):Int-instance-method","name":"write_to","doc":null,"summary":null,"abstract":true,"args":[{"name":"w","doc":null,"default_value":"","external_name":"w","restriction":"IO"}],"args_string":"(w : IO) : Int","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/reader.cr#L366","def":{"name":"write_to","args":[{"name":"w","doc":null,"default_value":"","external_name":"w","restriction":"IO"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int","visibility":"Public","body":""}}],"macros":[{"id":"method_missing(call)-macro","html_id":"method_missing(call)-macro","name":"method_missing","doc":null,"summary":null,"abstract":false,"args":[{"name":"call","doc":null,"default_value":"","external_name":"call","restriction":""}],"args_string":"(call)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/reader.cr#L372","def":{"name":"method_missing","args":[{"name":"call","doc":null,"default_value":"","external_name":"call","restriction":""}],"double_splat":null,"splat_index":null,"block_arg":null,"visibility":"Public","body":"      @io.\n{{ call }}\n\n    \n"}}],"types":[]}]},{"html_id":"github.com/naqvis/crystar/Crystar/SparseDatas","path":"Crystar/SparseDatas.html","kind":"alias","full_name":"Crystar::SparseDatas","name":"SparseDatas","abstract":false,"superclass":null,"ancestors":[],"locations":[{"filename":"tar/header.cr","line_number":347,"url":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr"}],"repository_name":"github.com/naqvis/crystar","program":false,"enum":false,"alias":true,"aliased":"Array(Crystar::SparseEntry)","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/naqvis/crystar/Crystar","kind":"module","full_name":"Crystar","name":"Crystar"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[]},{"html_id":"github.com/naqvis/crystar/Crystar/SparseEntry","path":"Crystar/SparseEntry.html","kind":"struct","full_name":"Crystar::SparseEntry","name":"SparseEntry","abstract":false,"superclass":{"html_id":"github.com/naqvis/crystar/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"github.com/naqvis/crystar/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"github.com/naqvis/crystar/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"github.com/naqvis/crystar/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"tar/header.cr","line_number":302,"url":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr"}],"repository_name":"github.com/naqvis/crystar","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/naqvis/crystar/Crystar","kind":"module","full_name":"Crystar","name":"Crystar"},"doc":"SparseEntry represents a Length-sized fragment at Offset in the file","summary":"<p>SparseEntry represents a Length-sized fragment at Offset in the file</p>","class_methods":[{"id":"empty-class-method","html_id":"empty-class-method","name":"empty","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L312","def":{"name":"empty","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@@empty"}}],"constructors":[{"id":"new(offset:Int64,length:Int64)-class-method","html_id":"new(offset:Int64,length:Int64)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"offset","doc":null,"default_value":"","external_name":"offset","restriction":"Int64"},{"name":"length","doc":null,"default_value":"","external_name":"length","restriction":"Int64"}],"args_string":"(offset : Int64, length : Int64)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L302","def":{"name":"new","args":[{"name":"offset","doc":null,"default_value":"","external_name":"offset","restriction":"Int64"},{"name":"length","doc":null,"default_value":"","external_name":"length","restriction":"Int64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(offset, length)\nif _.responds_to?(:finalize)\n  ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"==(other:self)-instance-method","html_id":"==(other:self)-instance-method","name":"==","doc":null,"summary":null,"abstract":false,"args":[{"name":"other","doc":null,"default_value":"","external_name":"other","restriction":"self"}],"args_string":"(other : <span class=\"k\">self</span>)","source_link":null,"def":{"name":"==","args":[{"name":"other","doc":null,"default_value":"","external_name":"other","restriction":"self"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if @offset == (other.@offset)\nelse\n  return false\nend\nif @length == (other.@length)\nelse\n  return false\nend\ntrue\n"}},{"id":"clone-instance-method","html_id":"clone-instance-method","name":"clone","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L302","def":{"name":"clone","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self.class.new(@offset.clone, @length.clone)"}},{"id":"copy_with(offset_offset=@offset,length_length=@length)-instance-method","html_id":"copy_with(offset_offset=@offset,length_length=@length)-instance-method","name":"copy_with","doc":null,"summary":null,"abstract":false,"args":[{"name":"_offset","doc":null,"default_value":"@offset","external_name":"offset","restriction":""},{"name":"_length","doc":null,"default_value":"@length","external_name":"length","restriction":""}],"args_string":"(offset _offset = @offset, length _length = @length)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L302","def":{"name":"copy_with","args":[{"name":"_offset","doc":null,"default_value":"@offset","external_name":"offset","restriction":""},{"name":"_length","doc":null,"default_value":"@length","external_name":"length","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self.class.new(_offset, _length)"}},{"id":"end_of_offset-instance-method","html_id":"end_of_offset-instance-method","name":"end_of_offset","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L306","def":{"name":"end_of_offset","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@offset + @length"}},{"id":"hash(hasher)-instance-method","html_id":"hash(hasher)-instance-method","name":"hash","doc":null,"summary":null,"abstract":false,"args":[{"name":"hasher","doc":null,"default_value":"","external_name":"hasher","restriction":""}],"args_string":"(hasher)","source_link":null,"def":{"name":"hash","args":[{"name":"hasher","doc":null,"default_value":"","external_name":"hasher","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"hasher = @offset.hash(hasher)\nhasher = @length.hash(hasher)\nhasher\n"}},{"id":"length:Int64-instance-method","html_id":"length:Int64-instance-method","name":"length","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int64","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L304","def":{"name":"length","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@length"}},{"id":"length=(length)-instance-method","html_id":"length=(length)-instance-method","name":"length=","doc":null,"summary":null,"abstract":false,"args":[{"name":"length","doc":null,"default_value":"","external_name":"length","restriction":""}],"args_string":"(length)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L304","def":{"name":"length=","args":[{"name":"length","doc":null,"default_value":"","external_name":"length","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@length = length"}},{"id":"offset:Int64-instance-method","html_id":"offset:Int64-instance-method","name":"offset","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int64","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L304","def":{"name":"offset","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@offset"}},{"id":"offset=(offset)-instance-method","html_id":"offset=(offset)-instance-method","name":"offset=","doc":null,"summary":null,"abstract":false,"args":[{"name":"offset","doc":null,"default_value":"","external_name":"offset","restriction":""}],"args_string":"(offset)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr#L304","def":{"name":"offset=","args":[{"name":"offset","doc":null,"default_value":"","external_name":"offset","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@offset = offset"}}],"macros":[],"types":[]},{"html_id":"github.com/naqvis/crystar/Crystar/SparseHoles","path":"Crystar/SparseHoles.html","kind":"alias","full_name":"Crystar::SparseHoles","name":"SparseHoles","abstract":false,"superclass":null,"ancestors":[],"locations":[{"filename":"tar/header.cr","line_number":348,"url":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/header.cr"}],"repository_name":"github.com/naqvis/crystar","program":false,"enum":false,"alias":true,"aliased":"Array(Crystar::SparseEntry)","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/naqvis/crystar/Crystar","kind":"module","full_name":"Crystar","name":"Crystar"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[]},{"html_id":"github.com/naqvis/crystar/Crystar/Writer","path":"Crystar/Writer.html","kind":"class","full_name":"Crystar::Writer","name":"Writer","abstract":false,"superclass":{"html_id":"github.com/naqvis/crystar/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"github.com/naqvis/crystar/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/naqvis/crystar/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"tar/writer.cr","line_number":33,"url":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/writer.cr"}],"repository_name":"github.com/naqvis/crystar","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[{"id":"LONG_NAME","name":"LONG_NAME","value":"\"././@LongLink\"","doc":"Use long-link files if Name or Linkname exceeds the field size.","summary":"<p>Use long-link files if Name or Linkname exceeds the field size.</p>"}],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/naqvis/crystar/Crystar","kind":"module","full_name":"Crystar","name":"Crystar"},"doc":"Writer provides sequential writing of a tar archive.\nWriter#write_header begins a new file with the provided Header,\nand then Writer can be treated as an io.Writer to supply that file's data via invoking Writer#write method .\n\n### Example\n```\nrequire \"tar\"\n\nFile.open(\"./file.tar\", \"w\") do |file|\n  Crystar::Writer.open(file) do |tar|\n    # add file to archive\n    tar.add File.open(\"./some_file.txt\")\n    # Manually create the Header with info per your choice\n    hdr = Header.new(\n      name: \"Your file Name\",\n      size: 100_i64,  # Contents size\n      mode: 0o644_i64 # Permission and mode bits\n    # ..... Look into `Crystar::Header`\n    )\n    tar.write_header hdr\n    tar.write \"your file contents\".to_slice\n\n    # Create header from File you have already opened.\n    hdr = file_info_header(file, file.path)\n    tar.write_header hdr\n    tar.write file.gets_to_end.to_slice\n  end\nend\n```","summary":"<p>Writer provides sequential writing of a tar archive.</p>","class_methods":[{"id":"open(io:IO,sync_close=false,&block)-class-method","html_id":"open(io:IO,sync_close=false,&amp;block)-class-method","name":"open","doc":"Creates a new writer to the given *io*, yields it to the given block,\nand closes it at the end.","summary":"<p>Creates a new writer to the given <em>io</em>, yields it to the given block, and closes it at the end.</p>","abstract":false,"args":[{"name":"io","doc":null,"default_value":"","external_name":"io","restriction":"IO"},{"name":"sync_close","doc":null,"default_value":"false","external_name":"sync_close","restriction":""}],"args_string":"(io : IO, sync_close = <span class=\"n\">false</span>, &block)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/writer.cr#L62","def":{"name":"open","args":[{"name":"io","doc":null,"default_value":"","external_name":"io","restriction":"IO"},{"name":"sync_close","doc":null,"default_value":"false","external_name":"sync_close","restriction":""}],"double_splat":null,"splat_index":null,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"writer = new(io, sync_close: sync_close)\nbegin\n  yield writer\nensure\n  writer.close\nend\n"}},{"id":"open(filename:String,&block)-class-method","html_id":"open(filename:String,&amp;block)-class-method","name":"open","doc":"Creates a new writer to the given *filename*, yields it to the given block,\nand closes it at the end.","summary":"<p>Creates a new writer to the given <em>filename</em>, yields it to the given block, and closes it at the end.</p>","abstract":false,"args":[{"name":"filename","doc":null,"default_value":"","external_name":"filename","restriction":"String"}],"args_string":"(filename : String, &block)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/writer.cr#L69","def":{"name":"open","args":[{"name":"filename","doc":null,"default_value":"","external_name":"filename","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"writer = new(filename)\nbegin\n  yield writer\nensure\n  writer.close\nend\n"}}],"constructors":[{"id":"new(io:IO,sync_close=false)-class-method","html_id":"new(io:IO,sync_close=false)-class-method","name":"new","doc":"Creates a new writer to the given *io*.","summary":"<p>Creates a new writer to the given <em>io</em>.</p>","abstract":false,"args":[{"name":"io","doc":null,"default_value":"","external_name":"io","restriction":"IO"},{"name":"sync_close","doc":null,"default_value":"false","external_name":"sync_close","restriction":""}],"args_string":"(io : IO, sync_close = <span class=\"n\">false</span>)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/writer.cr#L49","def":{"name":"new","args":[{"name":"io","doc":null,"default_value":"","external_name":"io","restriction":"IO"},{"name":"sync_close","doc":null,"default_value":"false","external_name":"sync_close","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(io, sync_close)\nif _.responds_to?(:finalize)\n  ::GC.add_finalizer(_)\nend\n_\n"}},{"id":"new(filename:String)-class-method","html_id":"new(filename:String)-class-method","name":"new","doc":"Creates a new writer to the given *filename*.","summary":"<p>Creates a new writer to the given <em>filename</em>.</p>","abstract":false,"args":[{"name":"filename","doc":null,"default_value":"","external_name":"filename","restriction":"String"}],"args_string":"(filename : String)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/writer.cr#L56","def":{"name":"new","args":[{"name":"filename","doc":null,"default_value":"","external_name":"filename","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new(::File.new(filename, \"w\"), sync_close: true)"}}],"instance_methods":[{"id":"add(file:File)-instance-method","html_id":"add(file:File)-instance-method","name":"add","doc":"Adds an entry that will have its data copied from the given *file*.\nfile is automatically closed after data is copied from it.","summary":"<p>Adds an entry that will have its data copied from the given <em>file</em>.</p>","abstract":false,"args":[{"name":"file","doc":null,"default_value":"","external_name":"file","restriction":"File"}],"args_string":"(file : File)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/writer.cr#L76","def":{"name":"add","args":[{"name":"file","doc":null,"default_value":"","external_name":"file","restriction":"File"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"hdr = Crystar.file_info_header(file, file.path)\nwrite_header(hdr)\nIO.copy(file, @curr)\nfile.close\n"}},{"id":"close-instance-method","html_id":"close-instance-method","name":"close","doc":"Close closes the tar archive by flushing the padding, and writing the footer.\nIf the current file (from a prior call to WriteHeader) is not fully written,\nthen this returns an error.","summary":"<p>Close closes the tar archive by flushing the padding, and writing the footer.</p>","abstract":false,"args":[],"args_string":"","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/writer.cr#L86","def":{"name":"close","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if @closed\n  return\nend\nflush()\n0.upto(1) do |_|\n  @io.write(Block.zero_block.to_bytes[..])\nend\nif @sync_close\n  @io.close\nend\n@closed = true\n"}},{"id":"closed?:Bool-instance-method","html_id":"closed?:Bool-instance-method","name":"closed?","doc":"Returns `true` if this writer is closed.","summary":"<p>Returns <code>true</code> if this writer is closed.</p>","abstract":false,"args":[],"args_string":" : Bool","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/writer.cr#L40","def":{"name":"closed?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@closed"}},{"id":"hdr=(hdr:Header)-instance-method","html_id":"hdr=(hdr:Header)-instance-method","name":"hdr=","doc":"Copy of Header that is safe for mutations","summary":"<p>Copy of Header that is safe for mutations</p>","abstract":false,"args":[{"name":"hdr","doc":null,"default_value":"","external_name":"hdr","restriction":"Header"}],"args_string":"(hdr : Header)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/writer.cr#L46","def":{"name":"hdr=","args":[{"name":"hdr","doc":null,"default_value":"","external_name":"hdr","restriction":"Header"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@hdr = hdr"}},{"id":"sync_close=(sync_close)-instance-method","html_id":"sync_close=(sync_close)-instance-method","name":"sync_close=","doc":"Whether to close the enclosed `IO` when closing this writer.","summary":"<p>Whether to close the enclosed <code>IO</code> when closing this writer.</p>","abstract":false,"args":[{"name":"sync_close","doc":null,"default_value":"","external_name":"sync_close","restriction":""}],"args_string":"(sync_close)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/writer.cr#L41","def":{"name":"sync_close=","args":[{"name":"sync_close","doc":null,"default_value":"","external_name":"sync_close","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@sync_close = sync_close"}},{"id":"sync_close?:Bool-instance-method","html_id":"sync_close?:Bool-instance-method","name":"sync_close?","doc":"Whether to close the enclosed `IO` when closing this writer.","summary":"<p>Whether to close the enclosed <code>IO</code> when closing this writer.</p>","abstract":false,"args":[],"args_string":" : Bool","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/writer.cr#L37","def":{"name":"sync_close?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@sync_close"}},{"id":"write(b:Bytes)-instance-method","html_id":"write(b:Bytes)-instance-method","name":"write","doc":"Write writes to the current file in the tar archive.\nWrite returns the error ErrWriteTooLong if more than\nHeader.Size bytes are written after WriteHeader.\n\nCalling Write on special types like LINK, SYMLINK, CHAR,\nBLOCK, DIR, and FIFO returns (0, ErrWriteTooLong) regardless\nof what the Header.Size claims.","summary":"<p>Write writes to the current file in the tar archive.</p>","abstract":false,"args":[{"name":"b","doc":null,"default_value":"","external_name":"b","restriction":"Bytes"}],"args_string":"(b : Bytes)","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/writer.cr#L117","def":{"name":"write","args":[{"name":"b","doc":null,"default_value":"","external_name":"b","restriction":"Bytes"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if @closed\n  raise(Error.new(\"Can't write to closed writer\"))\nend\n@curr.write(b)\n"}},{"id":"write_header(hdr:Header):Nil-instance-method","html_id":"write_header(hdr:Header):Nil-instance-method","name":"write_header","doc":"write_header writes hdr and prepares to accept the file's contents.\nThe Header.Size determines how many bytes can be written for the next file.\nIf the current file is not fully written, then this returns an error.\nThis implicitly flushes any padding necessary before writing the header.","summary":"<p>write_header writes hdr and prepares to accept the file's contents.</p>","abstract":false,"args":[{"name":"hdr","doc":null,"default_value":"","external_name":"hdr","restriction":"Header"}],"args_string":"(hdr : Header) : Nil","source_link":"https://github.com/naqvis/crystar/blob/e928324915a45949207a9ed7bc2f9b807be0148e/src/tar/writer.cr#L130","def":{"name":"write_header","args":[{"name":"hdr","doc":null,"default_value":"","external_name":"hdr","restriction":"Header"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Nil","visibility":"Public","body":"flush()\n@hdr = hdr\nif @hdr.flag == REGA\n  if @hdr.name.ends_with?(\"/\")\n    @hdr.flag = DIR.ord.to_u8\n  else\n    @hdr.flag = REG.ord.to_u8\n  end\nend\nif @hdr.format.none?\n  @hdr.access_time = Crystar.unix_time(0, 0)\n  @hdr.change_time = Crystar.unix_time(0, 0)\nend\nallowed_formats, pax_hdrs = @hdr.allowed_formats\ncase\nwhen allowed_formats.has(Format::USTAR)\n  write_ustar_header(@hdr)\nwhen allowed_formats.has(Format::PAX)\n  write_pax_header(@hdr, pax_hdrs)\nwhen allowed_formats.has(Format::GNU)\n  write_gnu_header(@hdr)\nend\n"}}],"macros":[],"types":[]}]}]}})