Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
JBrowser Source Code Files
JBrowser Source Code Files are provided in the
source package file.
You can download JBrowser source package as described in the previous tutorial and go to the "src" sub-folder to view Source Code files.
You can also browse JBrowser Source Code files below:
✍: FYIcenter
⏎ ru/atomation/utils/sevenzip/LZMAUtils.java
package ru.atomation.utils.sevenzip;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
import org.apache.commons.io.IOUtils;
import ru.atomation.utils.sevenzip.compression.lzma.Decoder;
/**
* Пакет для работы с lzma архивами //
* Package for work with lzma archives
* @author caiiiycuk
*/
public class LZMAUtils {
/**
* Распаковать lzma архив // Unpack lzma archive
* @param src файл архива // archive file
* @param dst директория распаковки // directory to extract
* @throws IOException
*/
public static void unpack(File src, File dst) throws IOException {
if (!src.isFile() || dst.isFile())
return;
if (!dst.exists())
dst.mkdir();
unpack(new BufferedInputStream(new FileInputStream(src)), dst);
}
/**
* Распаковать lzma архив // Unpack lzma archive
* @param src архива // archive
* @param dst директория распаковки // directory to extract
* @throws IOException
*/
public static void unpack(InputStream src, File dst) throws IOException {
src = new BufferedInputStream(src);
File buffFile = new File(dst, "temp-file.tar");
OutputStream buffer = new BufferedOutputStream(new FileOutputStream(
buffFile));
TarArchiveInputStream inTar = null;
try {
int propertiesSize = 5;
byte[] properties = new byte[propertiesSize];
if (src.read(properties, 0, propertiesSize) != propertiesSize)
throw new RuntimeException("input .lzma file is too short");
Decoder decoder = new Decoder();
if (!decoder.SetDecoderProperties(properties))
throw new RuntimeException("Incorrect stream properties");
long outSize = 0;
for (int i = 0; i < 8; i++) {
int v = src.read();
if (v < 0)
throw new RuntimeException("Can't read stream size");
outSize |= ((long) v) << (8 * i);
}
if (!decoder.Code(src, buffer, outSize))
throw new RuntimeException("Error in data stream");
buffer.flush();
IOUtils.closeQuietly(src);
IOUtils.closeQuietly(buffer);
inTar = new TarArchiveInputStream(new FileInputStream(buffFile));
TarArchiveEntry entry = null;
while ((entry = inTar.getNextTarEntry()) != null) {
File newFile = new File(dst, entry.getName());
if (entry.isDirectory())
newFile.mkdir();
else {
OutputStream output = null;
try {
output = new BufferedOutputStream(new FileOutputStream(
newFile));
IOUtils.copy(inTar, output);
} finally {
IOUtils.closeQuietly(output);
}
}
}
} finally {
IOUtils.closeQuietly(src);
IOUtils.closeQuietly(buffer);
IOUtils.closeQuietly(inTar);
//same as: FileUtils.deleteQuietly(buffFile);
try {
buffFile.delete();
} catch (Exception e) {
//ignoring
}
}
}
}
⏎ ru/atomation/utils/sevenzip/LZMAUtils.java
Or download all of them as a single archive file:
File name: jbrowser-1.9-fyi.zip File size: 625318 bytes Release date: 2022-11-10 Download
⇐ Download and Install JBrowser Source Package
2017-07-17, ≈34🔥, 1💬
Popular Posts:
How to download and install ojdbc5.jar for Oracle 11g R1? ojdbc5.jar for Oracle 11g R1 is a Java 5 J...
JDK 11 java.smartcardio.jmod is the JMOD file for JDK 11 Smartcardio module. JDK 11 Smart Card IO mo...
What Is poi-ooxml-3.5.jar? poi-ooxml-3.5.jar is one of the JAR files for Apache POI 3.5, which provi...
MP3SPI is a Java Service Provider Interface that adds MP3 (MPEG 1/2/2.5 Layer 1/2/3) audio format su...
Java Servlet API 3.0.1 Source Code Files are important if you want to compile them with different JD...