Java GZip Read getGzipExpandedBytes(File file)

Here you can find the source of getGzipExpandedBytes(File file)

Description

get Gzip Expanded Bytes

License

Apache License

Declaration

public static int getGzipExpandedBytes(File file) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.*;

public class Main {
    public static int getGzipExpandedBytes(File file) {
        try {/*from w  w w .  j a  v  a 2 s  .c  o m*/
            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();
            return (b1 << 24) | (b2 << 16) + (b3 << 8) + b4;

        } catch (Throwable t) {
            return -1;
        }
    }
}

Related

  1. getGzipByteArrayOutputStream(String domJson)
  2. getGZIPContents(File f)
  3. getGzippedBytesAsString(byte[] bytes)
  4. getGZippedContent(byte[] content)