Java Utililty Methods GZip Read

List of utility methods to do GZip Read

  1. HOME
  2. Java
  3. G
  4. GZip Read

Description

The list of methods to do GZip Read are organized into topic(s).

Method

byte[] getGzipByteArrayOutputStream(String domJson)
Get gzip byte array output stream byte [ ].
ByteArrayOutputStream resultStream = new ByteArrayOutputStream();
try {
 GZIPOutputStream gzip = new GZIPOutputStream(resultStream);
 gzip.write(domJson.getBytes());
 gzip.close();
} catch (IOException e) {
 e.printStackTrace();
return resultStream.toByteArray();
String getGZIPContents(File f)
get GZIP Contents
return getStringFromReader(
 new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(f)))));
int getGzipExpandedBytes(File file)
get Gzip Expanded Bytes
try {
 RandomAccessFile raf = new RandomAccessFile(file, "r");
 raf.seek(raf.length() - 4);
 int b4 = raf.read();
 int b3 = raf.read();
 int b2 = raf.read();
 int b1 = raf.read();
 raf.close();
...
String getGzippedBytesAsString(byte[] bytes)
get Gzipped Bytes As String
try {
 InputStream is = new ByteArrayInputStream(bytes);
 do {
 is = new BufferedInputStream(new GZIPInputStream(is));
 } while (isGzip(is));
 String s = getZipEntryAsString(is);
 is.close();
 return s;
...
byte[] getGZippedContent(byte[] content)
get G Zipped Content
byte[] gzippedContent = null;
if (content != null) {
 ByteArrayOutputStream bos = new ByteArrayOutputStream();
 ByteArrayInputStream bis = new ByteArrayInputStream(content);
 GZIPOutputStream out = new GZIPOutputStream(bos);
 byte[] buffer = new byte[1024];
 int read;
 while ((read = bis.read(buffer)) > 0) {
...

AltStyle によって変換されたページ (->オリジナル) /