mardi 28 octobre 2014

Java ByteBuffer for Zipfile


Vote count:

0




I have a binary file that contains big endian data. I am using this code to read it in



FileChannel fileInputChannel = new FileInputStream(fileInput).getChannel();
ByteBuffer bb = ByteBuffer.allocateDirect((int)fileInputChannel.size());
while (bb.remaining() > 0)
fileInputChannel.read(bb);
fileInputChannel.close();
bb.flip();


I have to do something identical for zip files. In other words decompress the file from a zip file and order it. I understand I can read it in via ZipInputStream but then I have to provide the coding for the "endianness". With ByteBuffer you can use ByteOrder.


Is there an NIO alternative for zip files ?



asked 1 min ago







Java ByteBuffer for Zipfile

Aucun commentaire:

Enregistrer un commentaire