How to decompress a gzipped data in a byte array?

后端 未结 4 573
别跟我提以往
别跟我提以往 2020-12-02 00:20

I have a class which has a method that is receiving an object as a parameter. This method is invoked via RMI.

public RMIClass extends Serializable {
    pub         


        
4条回答
  •  忘掉有多难
    2020-12-02 01:04

    If you want to write to a ByteBuffer you can do this.

    private static void uncompress(final byte[] input, final ByteBuffer output) throws IOException
        {
            final GZIPInputStream inputGzipStream = new GZIPInputStream(new ByteArrayInputStream(input));
            Channels.newChannel(inputGzipStream).read(output);
        }
    

提交回复
热议问题