/* using normal stream access and CachedByteArrays */
byte[] firstBuffer = new byte[bufferCapacity];
int bytesRead = ResourceUtils.readBuffer(in, firstBuffer);
if (bytesRead < 1) {
firstBuffer = new byte[0];
cachedBinary = new CachedByteArray(firstBuffer, 0);
size = 0L;
} else if (bytesRead < bufferCapacity) {
// size the buffer to the amount of bytes available:
// firstBuffer = Arrays.copyOf(firstBuffer, bytesRead);
cachedBinary = new CachedByteArray(firstBuffer, bytesRead);
size = (long) bytesRead;
} else {
cachedBinary = new CachedByteArrays(lruCapacity, bufferCapacity, firstBuffer, bufferCapacity);
tempFile = ArchiveFileUtils.writeEntryToTemp(tempDir, firstBuffer, in);
cachedBinary.setSourceFile(tempFile);