private void endCompression() throws IOException { /* * Now another magic 48-bit number, 0x177245385090, to indicate the end * of the last block. (sqrt(pi), if you want to know. I did want to use * e, but it contains too much repetition -- 27 18 28 18 28 46 -- for me * to feel statistically comfortable. Call me paranoid.) */ bsPutUByte(0x17); bsPutUByte(0x72); bsPutUByte(0x45); bsPutUByte(0x38); bsPutUByte(0x50); bsPutUByte(0x90); bsPutInt(this.combinedCRC); bsFinishedWithStream(); }
private void moveToFrontCodeAndSend() throws IOException { bsW(24, this.data.origPtr); generateMTFValues(); sendMTFValues(); }
public void finish() throws IOException { if (out != null) { try { if (this.runLength > 0) { writeRun(); } this.currentChar = -1; endBlock(); endCompression(); } finally { this.out = null; this.data = null; this.blockSorter = null; } } }
blockSort(); bsPutUByte(0x31); bsPutUByte(0x41); bsPutUByte(0x59); bsPutUByte(0x26); bsPutUByte(0x53); bsPutUByte(0x59); bsPutInt(this.blockCRC); bsW(1, 0); moveToFrontCodeAndSend();
static ExceptionThrowingTarBzInputStream create() throws IOException { // First provide real BZIP content so we don't err out when initialized final byte[] test = "Something more realistic than a single word".getBytes(); final ByteArrayOutputStream stream = new ByteArrayOutputStream(); BZip2CompressorOutputStream compressorOutputStream = new BZip2CompressorOutputStream(stream); compressorOutputStream.write(test); compressorOutputStream.close(); final InputStream in = new ByteArrayInputStream(stream.toByteArray()); return new ExceptionThrowingTarBzInputStream(in); }
public TarBzOutputStream(OutputStream out) throws IOException { super(null); this.bzip = new BZip2CompressorOutputStream(out); this.tos = new TarOutputStreamImpl(this.bzip); this.bos = new ByteArrayOutputStream(); }
/** * Writes magic bytes like BZ on the first position of the stream * and bytes indiciating the file-format, which is * huffmanised, followed by a digit indicating blockSize100k. * @throws IOException if the magic bytes could not been written */ private void init() throws IOException { bsPutUByte('B'); bsPutUByte('Z'); this.data = new Data(this.blockSize100k); this.blockSorter = new BlockSort(this.data); // huffmanised magic bytes bsPutUByte('h'); bsPutUByte('0' + this.blockSize100k); this.combinedCRC = 0; initBlock(); }
@Override public void close() throws IOException { if (out != null) { OutputStream outShadow = this.out; finish(); outShadow.close(); } }
blockSort(); bsPutUByte(0x31); bsPutUByte(0x41); bsPutUByte(0x59); bsPutUByte(0x26); bsPutUByte(0x53); bsPutUByte(0x59); bsPutInt(this.blockCRC); bsW(1, 0); moveToFrontCodeAndSend();
public TarBzOutputStream(OutputStream out) throws IOException { super(null); this.bzip = new BZip2CompressorOutputStream(out); this.tos = new TarOutputStreamImpl(this.bzip); this.bos = new ByteArrayOutputStream(); }
/** * Writes magic bytes like BZ on the first position of the stream * and bytes indiciating the file-format, which is * huffmanised, followed by a digit indicating blockSize100k. * @throws IOException if the magic bytes could not been written */ private void init() throws IOException { bsPutUByte('B'); bsPutUByte('Z'); this.data = new Data(this.blockSize100k); this.blockSorter = new BlockSort(this.data); // huffmanised magic bytes bsPutUByte('h'); bsPutUByte('0' + this.blockSize100k); this.combinedCRC = 0; initBlock(); }
/** * Overriden to close the stream. */ @Override protected void finalize() throws Throwable { finish(); super.finalize(); }
private void moveToFrontCodeAndSend() throws IOException { bsW(24, this.data.origPtr); generateMTFValues(); sendMTFValues(); }
private void endCompression() throws IOException { /* * Now another magic 48-bit number, 0x177245385090, to indicate the end * of the last block. (sqrt(pi), if you want to know. I did want to use * e, but it contains too much repetition -- 27 18 28 18 28 46 -- for me * to feel statistically comfortable. Call me paranoid.) */ bsPutUByte(0x17); bsPutUByte(0x72); bsPutUByte(0x45); bsPutUByte(0x38); bsPutUByte(0x50); bsPutUByte(0x90); bsPutInt(this.combinedCRC); bsFinishedWithStream(); }
public void finish() throws IOException { if (out != null) { try { if (this.runLength > 0) { writeRun(); } this.currentChar = -1; endBlock(); endCompression(); } finally { this.out = null; this.data = null; this.blockSorter = null; } } }
private void bsPutUByte(final int c) throws IOException { bsW(8, c); }