bzip2

Installing libbzip2 on Windows

青春壹個敷衍的年華 提交于 2019-12-13 21:08:47
问题 I am trying to install libbzip2 on Windows 7. (Actually I want to install wp2txt package, but it seems need to libbzip2). I installed "Bzip2 for Windows" as suggested by Alex. But I get following errors. C:\Users\John>gem install bzip2-ruby -- --with-bz2-include="C:\Program Files (x86)\GnuWin32\include" -- --with-bz2-lib="C:\Program Files (x86)\GnuWin32\lib" Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... ERROR: Error installing bzip2

Extremely slow R code and hanging

前提是你 提交于 2019-12-13 04:02:04
问题 Calling read.table() function (on a CSV file), as follows: download.file(url, destfile = file, mode = "w") conn <- gzcon(bzfile(file, open = "r")) try(fileData <- read.table(conn, sep = ",", row.names = NULL), silent = FALSE) produces the following error: Error in pushBack(c(lines, lines), file) : can only push back on text-mode connections I tried to “wrap” the connection explicitly by tConn <- textConnection(readLines(conn)) [and then, certainly, passing tConn instead of conn to read.table(

6.5 zip压缩工具 tar打包 打包并压缩

99封情书 提交于 2019-12-12 12:16:50
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 1.tar tar命令格式 [-zjxcvfpP] filename tar -z:表示同时用gzip压缩。 -j:表示同时用bzip2压缩。 -J:表示同时用xz压缩。 -x:表示解包或者解压缩。 -t:表示查看tar包里的文件。 -c:表示建立一个tar包或者压缩文件包。 -v:表示可视化。 -f:后面跟文件名(即-f filename,表示压缩后的文件名为filename,或者解压文件filename。多个参数组合的情况下,请把-f参数写到最后。) -P:表示使用原文件的属性。(不常用) -p:表示可以使用绝对路径。(不常用) --exclude filename:表示在打包或压缩时,不要将filename文件包括在内。(不常用) [root@localhost ~]# cd test -bash: cd: test: 没有那个文件或目录 [root@localhost ~]# cd /tmp/8/test [root@localhost test]# xz -d 1.txt.xz xz: 1.txt.xz: 没有那个文件或目录 [root@localhost test]# ls 1.txt [root@localhost test]# xz -z 1.txt.xz xz: 1.txt.xz:

How to efficiently parse large bz2 xml file in C

徘徊边缘 提交于 2019-12-12 04:54:08
问题 What I want to do: download OSM (OpenStreetMap) data in regular intervals (or update it using diffs) parse that data, which is an bzip2 compressed xml, and store the parts relevant to me in my database, as memory+cpu efficient as possible (runtime is not thaaaat much of an issue) What I have: xxx.osm.bz2 file (bzip2 compressed xml), compressed 29GB, uncompressed about 400GB software is running on debian linux, no vm or anything involved Specific questions, to elaborate what my problem is: I

exceptions from boost::iostreams::copy()

我是研究僧i 提交于 2019-12-11 05:43:58
问题 In the below code, I have a corrupt "hello.bz2" which has stray characters beyond the EOF. Is there a way to make the boost::iostreams::copy() call to throw ? #include <fstream> #include <iostream> #include <boost/iostreams/filtering_streambuf.hpp> #include <boost/iostreams/copy.hpp> #include <boost/iostreams/filter/bzip2.hpp> int main() { using namespace std; using namespace boost::iostreams; ifstream file("hello.bz2", ios_base::in | ios_base::binary); filtering_streambuf<input> in; in.push

gzip、bzip2、xz压缩工具

无人久伴 提交于 2019-12-10 07:05:17
9月30日任务 6.1 压缩打包介绍 6.2 gzip压缩工具 6.3 bzip2压缩工具 6.4 xz压缩工具 为什么要压缩 文件经过压缩后,其大小会缩小,可以节约服务器带宽资源、内存资源,节约运维成本! 常见压缩格式 Linux平台的常见压缩文件格式有以下几种 .zip .gz .bz2 .xz .tar.gz .tar.bz2 .tar.xz 虽然在Linux中文件后缀并不重要,但是为了便于区分和管理,压缩文件还是最好加上上述的一些后缀名 压缩工具 gzip压缩工具 gzip 不能压缩目录 !! 基本使用:压缩/解压缩 # 创建一个大文件 [root@localhost tmp]# find /etc/ -type f -exec cat {} >> 1.txt \; [root@localhost tmp]# ls -lh 总用量 25M -rw-r--r--. 1 root root 25M ... 1.txt #压缩文件:gzip file [root@localhost tmp]# gzip 1.txt [root@localhost tmp]# ls -lh 总用量 9.3M -rw-r--r--. 1 root root 9.3M ... 1.txt.gz #解压缩文件: gzip -d file.gz # gzip -d 等价于 gunzip [root

How to use SharpCompress' BZip2Stream to compress a string?

元气小坏坏 提交于 2019-12-08 12:24:49
问题 I am trying to compress a string (str) using SharpCompress' BZip2Stream but unable to achieve it. Following is the code I have so far, public static string Compress(string str) { var data = Encoding.UTF8.GetBytes(str); using (MemoryStream stream = new MemoryStream()) { using (BZip2Stream zip = new BZip2Stream(stream, SharpCompress.Compressor.CompressionMode.Compress)) { zip.Write(data, 0, data.Length); var compressed = Encoding.UTF8.GetString(stream.ToArray()); return compressed; } } } No

GoLang: Decompress bz2 in on goroutine, consume in other goroutine

允我心安 提交于 2019-12-07 13:13:52
问题 I am a new-grad SWE learning Go (and loving it). I am building a parser for Wikipedia dump files - basically a huge bzip2-compressed XML file (~50GB uncompressed). I want to do both streaming decompression and parsing, which sounds simple enough. For decompression, I do: inputFilePath := flag.Arg(0) inputReader := bzip2.NewReader(inputFile) And then pass the reader to the XML parser: decoder := xml.NewDecoder(inputFile) However, since both decompressing and parsing are expensive operations, I

BZ2 compression in C++ with bzlib.h

浪子不回头ぞ 提交于 2019-12-07 10:58:39
问题 I currently need some help learning how to use bzlib.h header. I was wondering if anyone would be as so kind to help me figure out a compressToBZ2() function in C++ without using any Boost libraries? void compressBZ2(std::string file) { std::ifstream infile; int fileDestination = infile.open(file.c_str()); char bz2Filename[] = "file.bz2"; FILE *bz2File = fopen(bz2Filename, "wb"); int bzError; const int BLOCK_MULTIPLIER = 7; BZFILE *myBZ = BZ2_bzWriteOpen(&bzError, bz2File, BLOCK_MULTIPLIER, 0

Why is seeking from the end of a file allowed for BZip2 files and not Gzip files?

試著忘記壹切 提交于 2019-12-07 09:03:10
问题 The Question I am parsing large compressed files in Python 2.7.6 and would like to know the uncompressed file size before starting. I am trying to use the second technique presented in this SO answer. It works for bzip2 formatted files but not gzip formatted files. What is different about the two compression algorithms that causes this? Example Code This code snipped demonstrates the behavior, assuming you have "test.bz2" and "test.gz" present in your current working directory: import os