| | | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | | 2 | | // Licensed under the MIT License. See License.txt in the project root for license information. |
| | | 3 | | |
| | | 4 | | namespace Microsoft.Azure.Batch |
| | | 5 | | { |
| | | 6 | | using System; |
| | | 7 | | |
| | | 8 | | /// <summary> |
| | | 9 | | /// The byte range to retrieve in a file download operation. |
| | | 10 | | /// </summary> |
| | | 11 | | public class GetFileRequestByteRange |
| | | 12 | | { |
| | | 13 | | private const string OcpRangeFormat = "bytes={0}-{1}"; |
| | | 14 | | |
| | | 15 | | /// <summary> |
| | | 16 | | /// Gets the start of the byte range to retrieve. |
| | | 17 | | /// </summary> |
| | 8 | 18 | | public int StartRange { get; private set; } |
| | | 19 | | |
| | | 20 | | /// <summary> |
| | | 21 | | /// Gets the end of the byte range to retrieve. |
| | | 22 | | /// </summary> |
| | 8 | 23 | | public int EndRange { get; private set; } |
| | | 24 | | |
| | | 25 | | /// <summary> |
| | | 26 | | /// Initializes a new instance of the <see cref="GetFileRequestByteRange"/> class. |
| | | 27 | | /// </summary> |
| | | 28 | | /// <param name="startRange">The start of the byte range to retrieve.</param> |
| | | 29 | | /// <param name="endRange">The end of the byte range to retrieve.</param> |
| | 4 | 30 | | public GetFileRequestByteRange(int startRange, int endRange) |
| | | 31 | | { |
| | 4 | 32 | | this.StartRange = startRange; |
| | 4 | 33 | | this.EndRange = endRange; |
| | 4 | 34 | | } |
| | | 35 | | |
| | | 36 | | internal string GetOcpRangeHeader() |
| | | 37 | | { |
| | 4 | 38 | | return string.Format(System.Globalization.CultureInfo.InvariantCulture, OcpRangeFormat, this.StartRange, thi |
| | | 39 | | } |
| | | 40 | | } |
| | | 41 | | } |