开发者

How to convert Integer array to InputStream?

开发者 https://www.devze.com 2023-04-11 10:08 出处:网络
I would like to convert an integer array in java, to an Inputstream, after that I would like to use the stream of bytes to be decompressed using LZMA library.

I would like to convert an integer array in java, to an Inputstream, after that I would like to use the stream of bytes to be decompressed using LZMA library.

int [] header = new int[copy.length];

edu.coeia.Compression.LZMA.Decoder decoder = new  edu.coeia.Compression.LZMA.Decoder();
ByteArrayInputStream bStream = new ByteArrayInputStream(bheader);

bStream.coder(// InputSream of开发者_运维技巧 bytes);


What you need to do is convert the array of integers into an equivalent array of bytes, and then use the ByteArrayInputStream(byte[]) constructor to create the input stream. Finally, decode the stream using the code that you already have.

The first step (conversion) is probably the one that you are having difficulty with, but the code depends on how the bytes are represented in the integer array.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号