// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
namespace Microsoft.ClearScript.JavaScript
{
///
/// Represents a JavaScript
/// ArrayBuffer.
///
public interface IArrayBuffer
{
///
/// Gets the size of the ArrayBuffer in bytes.
///
ulong Size { get; }
///
/// Creates a byte array containing a copy of the ArrayBuffer's contents.
///
/// A new byte array containing a copy of the ArrayBuffer's contents.
byte[] GetBytes();
///
/// Copies bytes from the ArrayBuffer into the specified byte array.
///
/// The offset within the ArrayBuffer of the first byte to copy.
/// The maximum number of bytes to copy.
/// The byte array into which to copy the bytes.
/// The index within at which to store the first copied byte.
/// The number of bytes copied.
ulong ReadBytes(ulong offset, ulong count, byte[] destination, ulong destinationIndex);
///
/// Copies bytes from the specified byte array into the ArrayBuffer.
///
/// The byte array from which to copy the bytes.
/// The index within of the first byte to copy.
/// The maximum number of bytes to copy.
/// The offset within the ArrayBuffer at which to store the first copied byte.
/// The number of bytes copied.
ulong WriteBytes(byte[] source, ulong sourceIndex, ulong count, ulong offset);
}
}