C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
C# program that uses File.ReadAllBytes method
using System;
using System.IO;
class Program
{
static void Main()
{
byte[] array = File.ReadAllBytes("C:\\a");
Console.WriteLine("First byte: {0}", array[0]);
Console.WriteLine("Last byte: {0}",
array[array.Length - 1]);
Console.WriteLine(array.Length);
}
}
Output
First byte: 29
Last byte: 0
5407219
Then: Use BinaryReader to index the contents of the file. Whenever a resource is required, just access the byte range from the byte array.
Note: This can collapse thousands of objects into a single object on the large object heap.
Object