简体   繁体   中英

How to store Binary File data in ArrayList

Ok so essentially I want to take each byte from a binary file and then store each byte in an arrayList of bytes. My question is how do I insert those bytes in the arrayList. I tried the code below but the readByte function will only keep reading the first byte and will not increment. How do I increment?

while(true) {
            Byte b = out.readByte();
            a1.add(b);


        }


        } catch(EOFException e) {

    }

Ok so essentially I want to take each byte from a binary file and then store each byte in an arrayList of bytes. My question is how do I insert those bytes in the arrayList. I tried the code below but the readByte function will only keep reading the first byte and will not increment. How do I increment?

while(true) {
            Byte b = out.readByte();
            a1.add(b);


        }


        } catch(EOFException e) {

    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM