Stay organized with collections
Save and categorize content based on your preferences.
publicclassByteRange
A byte range as parsed from a request Range header. Format produced by this class is
also compatible with the X-AppEngine-BlobRange header, used for serving sub-ranges of
blobs.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003e\u003ccode\u003eByteRange\u003c/code\u003e is a class for parsing and representing byte ranges from request headers, compatible with both \u003ccode\u003eRange\u003c/code\u003e and \u003ccode\u003eX-AppEngine-BlobRange\u003c/code\u003e headers.\u003c/p\u003e\n"],["\u003cp\u003eThe class includes static methods, \u003ccode\u003eparse\u003c/code\u003e and \u003ccode\u003eparseContentRange\u003c/code\u003e, to extract byte range information from header strings.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eByteRange\u003c/code\u003e objects can be constructed with a start index, or a start and end index, which allows users to define a section of bytes from the whole.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egetStart()\u003c/code\u003e and \u003ccode\u003egetEnd()\u003c/code\u003e methods retrieve the starting and ending indices of the byte range, respectively, and \u003ccode\u003ehasEnd()\u003c/code\u003e indicates if an end index is specified.\u003c/p\u003e\n"],["\u003cp\u003eThe class overrides the \u003ccode\u003eequals()\u003c/code\u003e, \u003ccode\u003ehashCode()\u003c/code\u003e, and \u003ccode\u003etoString()\u003c/code\u003e methods for comparing, identifying, and formatting \u003ccode\u003eByteRange\u003c/code\u003e objects.\u003c/p\u003e\n"]]],[],null,["# Class ByteRange (2.0.0)\n\n public class ByteRange\n\nA byte range as parsed from a request Range header. Format produced by this class is\nalso compatible with the X-AppEngine-BlobRange header, used for serving sub-ranges of\nblobs. \n\nInheritance\n-----------\n\n[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \\\u003e ByteRange \n\nInherited Members\n-----------------\n\n[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) \n[Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) \n[Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) \n[Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) \n[Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) \n[Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) \n[Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) \n[Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) \n[Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)\n\nStatic Methods\n--------------\n\n### parse(String byteRange)\n\n public static ByteRange parse(String byteRange)\n\nParse byte range from header.\n\n### parseContentRange(String contentRange)\n\n public static ByteRange parseContentRange(String contentRange)\n\nParse content range from header for byte-range only.\n\nConstructors\n------------\n\n### ByteRange(long start)\n\n public ByteRange(long start)\n\nConstructor.\n\n### ByteRange(long start, @Nullable Long end)\n\n protected ByteRange(long start, @Nullable Long end)\n\n### ByteRange(long start, long end)\n\n public ByteRange(long start, long end)\n\nConstructor.\n\nMethods\n-------\n\n### equals(@Nullable Object object)\n\n public boolean equals(@Nullable Object object)\n\nTwo `ByteRange` objects are considered equal if they have the same start and end.\n\n**Overrides** \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-)\n\n### getEnd()\n\n public long getEnd()\n\nGet end index of byte range.\n\n### getStart()\n\n public long getStart()\n\nGet start index of byte range.\n\n### hasEnd()\n\n public boolean hasEnd()\n\nIndicates whether or not this byte range indicates an end.\n\n### hashCode()\n\n public int hashCode()\n\n**Overrides** \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--)\n\n### toString()\n\n public String toString()\n\nFormat byte range for use in header.\n\n**Overrides** \n[Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--)"]]