FileBuffer constructor

FileBuffer(
  1. AbstractFileHandle _file, {
  2. int byteOrder = LITTLE_ENDIAN,
  3. int bufferSize = kDefaultBufferSize,
})

Implementation

FileBuffer(
  this._file, {
  this.byteOrder = LITTLE_ENDIAN,
  int bufferSize = kDefaultBufferSize,
}) {
  _fileSize = _file.length;
  // Prevent having a buffer smaller than the minimum buffer size
  _bufferSize = max(
    // If possible, avoid having a buffer bigger than the file itself
    min(bufferSize, _fileSize),
    kMinBufferSize,
  );
  _buffer = Uint8List(_bufferSize);
  _readBuffer(0, _fileSize);
}