处理字节块 [英] Handling Blocks of Bytes
问题描述
关于处理的问题Byte []在java。
我必须读取任何类型的文件并将其切成块以便稍后处理。
想知道如果我做了一个Byte [] []将Byte []保存在一个数组中,或者其他东西是更好的方法,因为我现在知道Byte []数组可以容纳多少元素作为文件可能很大,块可能很小。
谢谢。 :)
Just a question on handling "Byte[]" in java.
I have to read in a file of any type and chop it up into blocks for processing later on.
Was wondering if I got do a Byte[][] to keep the Byte[] in an array or would something else be a better way of doing it as I do now know how many elements the array of Byte[] can hold as the file might be huge and the blocks might be small.
Thanks. :)
推荐答案
只是关于处理的问题Byte []在java。
我必须读取任何类型的文件并将其切成块以便稍后处理。
想知道如果我做了一个Byte [] []将Byte []保存在一个数组中,或者其他东西是更好的方法,因为我现在知道Byte []数组可以容纳多少元素作为文件可能很大,块可能很小。
谢谢。 :)
Just a question on handling "Byte[]" in java.
I have to read in a file of any type and chop it up into blocks for processing later on.
Was wondering if I got do a Byte[][] to keep the Byte[] in an array or would something else be a better way of doing it as I do now know how many elements the array of Byte[] can hold as the file might be huge and the blocks might be small.
Thanks. :)
为什么不使用ArrayList< byte []>为了那个原因?只需将您在ArrayList中读取的所有byte [] s
叠加起来。
亲切的问候,
Jos
Why don''t you use an ArrayList<byte[]> for that? Simply stack up all the byte[]s
you have read in the ArrayList.
kind regards,
Jos
为什么不使用ArrayList< byte []>为了那个原因?只需将您在ArrayList中读取的所有byte [] s
叠加起来。
亲切的问候,
Jos
Why don''t you use an ArrayList<byte[]> for that? Simply stack up all the byte[]s
you have read in the ArrayList.
kind regards,
Jos
ok谢谢稍后试试:)
ok thanks will give it a try later :)
哦顺便说一句...只是为了确认,当我在将它们分成块之前先读入整个文件,Byte [19]会引用文件中的第20个字节吗?
oh btw... just to confirm, when i read in the whole file at the first go before chopping them up into blocks, Byte[19] would refer to the 20th byte in the file right?
这篇关于处理字节块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!