src/main/java/com/netflix/imflibrary/utils/ByteArrayByteRangeProvider.java [76:112]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(rangeFile)))
        {
            long numBytesSkipped = 0;
            while (numBytesSkipped < rangeStart)
            {
                numBytesSkipped += bis.skip(rangeStart - numBytesSkipped);
            }

            long totalNumberOfBytesRead = 0;
            byte[] bytes = new byte[BUFFER_SIZE];
            while (totalNumberOfBytesRead < (rangeEnd - rangeStart + 1))
            {
                int numBytesToRead = (int)Math.min(BUFFER_SIZE, rangeEnd - rangeStart + 1 - totalNumberOfBytesRead);
                int numBytesRead = bis.read(bytes, 0, numBytesToRead);
                if (numBytesRead == EOF)
                {
                    throw new EOFException();
                }
                bos.write(bytes, 0, numBytesRead);
                totalNumberOfBytesRead += numBytesRead;
            }
        }

        return rangeFile;
    }

    /**
     * This method provides a way to obtain a byte range from the resource in-memory. A limitation of this method is
     * that the total size of the byte range request is capped at 0x7fffffff (the maximum value possible for type int
     * in java)
     *
     * @param rangeStart zero indexed inclusive start offset; ranges from 0 through (resourceSize -1) both included
     * @param rangeEnd zero indexed inclusive end offset; ranges from 0 through (resourceSize -1) both included
     * @return byte[] containing desired byte range
     * @throws IOException - any I/O related error will be exposed through an IOException
     */
    public byte[] getByteRangeAsBytes(long rangeStart, long rangeEnd) throws IOException
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



src/main/java/com/netflix/imflibrary/utils/FileByteRangeProvider.java [87:123]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(rangeFile)))
        {
            long numBytesSkipped = 0;
            while (numBytesSkipped < rangeStart)
            {
                numBytesSkipped += bis.skip(rangeStart - numBytesSkipped);
            }

            long totalNumberOfBytesRead = 0;
            byte[] bytes = new byte[BUFFER_SIZE];
            while (totalNumberOfBytesRead < (rangeEnd - rangeStart + 1))
            {
                int numBytesToRead = (int)Math.min(BUFFER_SIZE, rangeEnd - rangeStart + 1 - totalNumberOfBytesRead);
                int numBytesRead = bis.read(bytes, 0, numBytesToRead);
                if (numBytesRead == EOF)
                {
                    throw new EOFException();
                }
                bos.write(bytes, 0, numBytesRead);
                totalNumberOfBytesRead += numBytesRead;
            }
        }

        return rangeFile;
    }

    /**
     * This method provides a way to obtain a byte range from the resource in-memory. A limitation of this method is
     * that the total size of the byte range request is capped at 0x7fffffff (the maximum value possible for type int
     * in java)
     *
     * @param rangeStart zero indexed inclusive start offset; ranges from 0 through (resourceSize -1) both included
     * @param rangeEnd zero indexed inclusive end offset; ranges from 0 through (resourceSize -1) both included
     * @return byte[] containing desired byte range
     * @throws IOException - any I/O related error will be exposed through an IOException
     */
    public byte[] getByteRangeAsBytes(long rangeStart, long rangeEnd) throws IOException
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



