public static < T extends Chunkable > List < byte [ ] > chunksFrom ( T chunkable , int chunkLength ) { List < byte [ ] > chunks = new ArrayList <> ( ) ; int chunkCount = chunkCountFrom ( chunkable , chunkLength ) ; for ( int i = 0 ; i < chunkCount ; i ++ ) { byte [ ] chunk = chunkFrom ( chunkable , chunkLength , i ) ; chunks . add ( chunk ) ; } return chunks ; }
Retrieve all chunks for a given chunk length . The final chunk may be shorter than the other chunks if it s been truncated .