| Modifier and Type | Field and Description |
|---|---|
| private static final byte[] | |
| private static final byte[] | |
| private static final byte[] | |
| private static final Map | |
| private static final byte[] |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static final int | Returns: position just after the space in "author ", so the first character of the author's name. If no author header can be located -1 is returned.buffer to scan. b, int position in buffer to start the scan at. Most callers should
pass 0 to ensure the scan starts from the beginning of the
commit buffer and does not accidentally look at message body. ptr)Locate the "author " header line data. |
| private static Charset | |
| public static final int | Returns: position of the user's message buffer.buffer to scan. b, int position in buffer to start the scan at. Most callers should
pass 0 to ensure the scan starts from the beginning of the
commit buffer. ptr)Locate the position of the commit message body. |
| public static final int | Returns: position just after the space in "committer ", so the first character of the committer's name. If no committer header can be located -1 is returned.buffer to scan. b, int position in buffer to start the scan at. Most callers should
pass 0 to ensure the scan starts from the beginning of the
commit buffer and does not accidentally look at message body. ptr)Locate the "committer " header line data. |
| public static String | Returns: a string representation of the range[start,end),
after decoding the region through the specified character set.buffer to pull raw bytes from. buffer)Decode a buffer under UTF-8, if possible. |
| public static String | Returns: a string representation of the range[start,end),
after decoding the region through the specified character set.buffer to pull raw bytes from. buffer, final int start position in buffer start, final int one position past the last location within the buffer to take
data from. end)Decode a buffer under UTF-8, if possible. |
| public static String | |
| public static String | Returns: a string representation of the range[start,end),
after decoding the region through the specified character set.character set to use when decoding the buffer. cs, final byte[] buffer to pull raw bytes from. buffer, final int first position within the buffer to take data from. start, final int one position past the last location within the buffer to take
data from. end)Decode a region of the buffer under the specified character set if possible. |
| private static String | |
| public static String | Returns: a string representation of the range[start,end),
after decoding the region through the specified character set.character set to use when decoding the buffer. cs, final byte[] buffer to pull raw bytes from. buffer, final int first position within the buffer to take data from. start, final int one position past the last location within the buffer to take
data from. end)Decode a region of the buffer under the specified character set if possible. |
| public static final int | Returns: position just after the space in "encoding ", so the first character of the encoding's name. If no encoding header can be located -1 is returned (and UTF-8 should be assumed).buffer to scan. b, int position in buffer to start the scan at. Most callers should
pass 0 to ensure the scan starts from the beginning of the
buffer and does not accidentally look at the message body. ptr)Locate the "encoding " header line. |
| public static int | Returns: position of the ':' which terminates the footer line key if this is otherwise a valid footer line key; otherwise -1.buffer to scan. raw, int first position within raw to consider as a footer line key. ptr)Locate the end of a footer line key string. |
| public static final int | Returns: position of the LF at the end of the paragraph;b.length if no paragraph end could be located.buffer to scan. b, int position in buffer to start the scan at. Most callers will
want to pass the first position of the commit message (as
found by start)commitMessage(byte[], int).Locate the end of a paragraph. |
| public static String | Returns: a string representation of the range[start,end).buffer to pull raw bytes from. buffer, final int first position within the buffer to take data from. start, final int one position past the last location within the buffer to take
data from. end)Decode a region of the buffer under the ISO-8859-1 encoding. |
| public static int | Returns: the new offset valueo. This is the position of
the last byte written. Additional writing should start at one
position earlier.buffer to write into. b, int one offset past the location where writing will begin; writing
proceeds towards lower index values. o, int the value to store. value)Format a base 10 numeric into a temporary buffer. |
| public static Charset | Returns: the Java character set representation. Never null. Default to UTF-8.buffer to scan. buffer)Parse the "encoding " header into a character set reference. |
| public static final boolean | Returns: whether the message starts with any known headersbuffer to scan. b)Returns whether the message starts with any known headers. |
| public static final int | Returns: new position just after the line end. This is either b.length, or the index of the header's terminating newline.buffer to scan. b, int position within buffer to start looking for the header
(normally a new-line). ptr)
Deprecated
use {
nextLfSkippingSplitLines} directly instead
Locate the first end of header after the given position. |
| public static final int | Returns: new position at the start of the header's contents, -1 for not foundheader to search for headerName, byte[] buffer to scan. b, int position within buffer to start looking for header at. ptr)Find the start of the contents of a given header. |
| public static final byte[] | Returns: the header value, with blanks indicating continuation lines strippedbuffer to extract the header from b, int of the header value, see
start, int headerStart(byte[], byte[], int)of the header; see
end)nextLfSkippingSplitLines(byte[], int)Extract a part of a buffer as a header value, removing the single blanks at the front of continuation lines. |
| public static int | Returns: last index ofch in raw, trimming spaces.buffer to scan. raw, char character to find. ch, int starting position. pos)Get last index of |
| public static final IntList | Returns: a line map indicating the starting position of each line.buffer to scan. buf, int position within the buffer corresponding to the first byte of
line 1. ptr, int 1 past the end of the content within end)buf.Index the region between |
| public static final IntList | Returns: a line map indicating the starting position of each line.buffer to scan. buf, int position within the buffer corresponding to the first byte of
line 1. ptr, int 1 past the end of the content within end)buf.Like |
| public static final int | Returns: ptr + src.length if b[ptr..src.length] == src; else -1.the buffer to scan. b, int first position within b, this should match src[0]. ptr, byte[] the buffer to test for equality with b. src)Determine if b[ptr] matches src. |
| public static final int | Returns: new position just after chrA.buffer to scan. b, int position within buffer to start looking for chrA at. ptr, char character to find. chrA)Locate the first position after a given character. |
| public static final int | Returns: new position just after the first LF found.buffer to scan. b, int position within buffer to start looking for LF at. ptr)Locate the first position after the next LF. |
| public static final int | Returns: new position just after the first chrA or LF to be found.buffer to scan. b, int position within buffer to start looking for chrA or LF at. ptr, char character to find. chrA)Locate the first position after either the given character or LF. |
| public static final int | Returns: new position just after the line end of the last line-split. This is either b.length, or the index of the current split-line's terminating newline.buffer to scan. b, int position within buffer to start looking for the next line. ptr)Locate the first end of line after the given position, while treating following lines which are starting with spaces as part of the current line. |
| public static final int | Returns: the value at this location; 0 if the location is not a valid numeric.buffer to scan. b, int position within buffer to start parsing digits at. ptr, final MutableInteger optional location to return the new ptr value through. If null
the ptr value will be discarded. ptrResult)Parse a base 10 numeric from a sequence of ASCII digits into an int. |
| public static Charset | Returns: the Java character set representation. Never null.buffer to scan. b)Parse the "encoding " header into a character set reference. |
| public static String | Returns: the encoding header as specified in the commit; null if the header was not present and should be assumed.buffer to scan. b)Parse the "encoding " header as a string. |
| public static final int | Returns: the integer value.buffer to parse digits from; positions bs, final int [p, p+4) will
be parsed.first position within the buffer to parse. p)Parse 4 character base 16 (hex) formatted string to unsigned integer. |
| public static final int | Returns: the integer value.buffer to parse digits from; positions bs, final int [p, p+8) will
be parsed.first position within the buffer to parse. p)Parse 8 character base 16 (hex) formatted string to unsigned integer. |
| public static final int | Returns: numeric value, in the range 0-15.hex character to parse. digit)Parse a single hex digit to its numeric value (0-15). |
| public static final long | Returns: the integer value.buffer to parse digits from; positions bs, final int [p, p+16) will
be parsed.first position within the buffer to parse. p)Parse 16 character base 16 (hex) formatted string to unsigned long. |
| public static final long | Returns: the value at this location; 0 if the location is not a valid numeric.buffer to scan. b, int position within buffer to start parsing digits at. ptr, final MutableInteger optional location to return the new ptr value through. If null
the ptr value will be discarded. ptrResult)Parse a base 10 numeric from a sequence of ASCII digits into a long. |
| public static PersonIdent | Returns: the parsed identity or null in case the identity could not be parsed.the string to parse a name from. in)Parse a name string (e.g. author, committer, tagger) into a PersonIdent. |
| public static PersonIdent | Returns: the parsed identity or null in case the identity could not be parsed.the buffer to parse character data from. raw, int first position of the identity information. This should be the
first position after the space which delimits the header field
name (e.g. "author" or "committer") from the rest of the
identity line. nameB)Parse a name line (e.g. author, committer, tagger) into a PersonIdent. |
| public static PersonIdent | Returns: the parsed identity. Never null.the buffer to parse character data from. raw, final int first position of the identity information. This should be the
first position after the space which delimits the header field
name (e.g. "author" or "committer") from the rest of the
identity line. nameB)Parse a name data (e.g. as within a reflog) into a PersonIdent. |
| public static final int | Returns: the timezone at this location, expressed in minutes.buffer to scan. b, int position within buffer to start parsing digits at. ptr)Parse a Git style timezone string. |
| public static final int | Returns: the timezone at this location, expressed in minutes.buffer to scan. b, int position within buffer to start parsing digits at. ptr, MutableInteger optional location to return the new ptr value through. If null
the ptr value will be discarded. ptrResult)Parse a Git style timezone string. |
| private static ZoneId | Returns: the ZoneOffset represention of the timezone offset string. Invalid offsets default to UTC.buffer to scan. b, int position within buffer to start parsing digits at. ptr, MutableInteger optional location to return the new ptr value through. If null
the ptr value will be discarded. ptrResult)Parse a Git style timezone string in [+-]hhmm format |
| public static final int | Returns: new position just before chrA, -1 for not foundbuffer to scan. b, int position within buffer to start looking for chrA at. ptr, char character to find. chrA)Locate the first position before a given character. |
| public static final int | Returns: new position just before the first LF found, -1 for not foundbuffer to scan. b, int position within buffer to start looking for LF at. ptr)Locate the first position before the previous LF. |
| public static final int | Returns: new position just before the first chrA or LF to be found, -1 for not foundbuffer to scan. b, int position within buffer to start looking for chrA or LF at. ptr, char character to find. chrA)Locate the previous position before either the given character or LF. |
| public static final int | Returns: position just after the space in "tagger ", so the first character of the tagger's name. If no tagger header can be located -1 is returned.buffer to scan. b, int position in buffer to start the scan at. Most callers should
pass 0 to ensure the scan starts from the beginning of the tag
buffer and does not accidentally look at message body. ptr)Locate the "tagger " header line data. |
| public static final int | Returns: position of the user's message buffer.buffer to scan. b, int position in buffer to start the scan at. Most callers should
pass 0 to ensure the scan starts from the beginning of the tag
buffer. ptr)Locate the position of the tag message body. |
| base10byte | back to summary |
|---|---|
| private static final byte[] base10byte | |
| digits10 | back to summary |
|---|---|
| private static final byte[] digits10 | |
| digits16 | back to summary |
|---|---|
| private static final byte[] digits16 | |
| encodingAliases | back to summary |
|---|---|
| private static final Map<String, Charset> encodingAliases | |
| footerLineKeyChars | back to summary |
|---|---|
| private static final byte[] footerLineKeyChars | |
| RawParseUtils | back to summary |
|---|---|
| private RawParseUtils() | |
| author | back to summary |
|---|---|
| public static final int author(byte[] b, int ptr) Locate the "author " header line data.
| |
| charsetForAlias | back to summary |
|---|---|
| private static Charset charsetForAlias(String name) | |
| commitMessage | back to summary |
|---|---|
| public static final int commitMessage(byte[] b, int ptr) Locate the position of the commit message body.
| |
| committer | back to summary |
|---|---|
| public static final int committer(byte[] b, int ptr) Locate the "committer " header line data.
| |
| decode | back to summary |
|---|---|
| public static String decode(byte[] buffer) Decode a buffer under UTF-8, if possible. If the byte stream cannot be decoded that way, the platform default is tried and if that too fails, the fail-safe ISO-8859-1 encoding is tried.
| |
| decode | back to summary |
|---|---|
| public static String decode(final byte[] buffer, final int start, final int end) Decode a buffer under UTF-8, if possible. If the byte stream cannot be decoded that way, the platform default is tried and if that too fails, the fail-safe ISO-8859-1 encoding is tried.
| |
| decode | back to summary |
|---|---|
| public static String decode(Charset cs, byte[] buffer) Decode a buffer under the specified character set if possible. If the byte stream cannot be decoded that way, the platform default is tried and if that too fails, the fail-safe ISO-8859-1 encoding is tried. | |
| decode | back to summary |
|---|---|
| public static String decode(final Charset cs, final byte[] buffer, final int start, final int end) Decode a region of the buffer under the specified character set if possible. If the byte stream cannot be decoded that way, the platform default is tried and if that too fails, the fail-safe ISO-8859-1 encoding is tried.
| |
| decode | back to summary |
|---|---|
| private static String decode(ByteBuffer b, Charset charset) throws CharacterCodingException | |
| decodeNoFallback | back to summary |
|---|---|
| public static String decodeNoFallback(final Charset cs, final byte[] buffer, final int start, final int end) throws CharacterCodingException Decode a region of the buffer under the specified character set if possible. If the byte stream cannot be decoded that way, the platform default is tried and if that too fails, an exception is thrown.
| |
| encoding | back to summary |
|---|---|
| public static final int encoding(byte[] b, int ptr) Locate the "encoding " header line.
| |
| endOfFooterLineKey | back to summary |
|---|---|
| public static int endOfFooterLineKey(byte[] raw, int ptr) Locate the end of a footer line key string.
If the region at
If the region at
| |
| endOfParagraph | back to summary |
|---|---|
| public static final int endOfParagraph(byte[] b, int start) Locate the end of a paragraph. A paragraph is ended by two consecutive LF bytes or CRLF pairs
| |
| extractBinaryString | back to summary |
|---|---|
| public static String extractBinaryString(final byte[] buffer, final int start, final int end) Decode a region of the buffer under the ISO-8859-1 encoding. Each byte is treated as a single character in the 8859-1 character encoding, performing a raw binary->char conversion.
| |
| formatBase10 | back to summary |
|---|---|
| public static int formatBase10(final byte[] b, int o, int value) Format a base 10 numeric into a temporary buffer.
Formatting is performed backwards. The method starts at offset
The argument and return values from this method make it easy to chain writing, for example: final byte[] tmp = new byte[64]; int ptr = tmp.length; tmp[--ptr] = '\n'; ptr = RawParseUtils.formatBase10(tmp, ptr, 32); tmp[--ptr] = ' '; ptr = RawParseUtils.formatBase10(tmp, ptr, 18); tmp[--ptr] = 0; final String str = new String(tmp, ptr, tmp.length - ptr);
| |
| guessEncoding | back to summary |
|---|---|
| public static Charset guessEncoding(byte[] buffer) Parse the "encoding " header into a character set reference. If unsuccessful, return UTF-8.
| |
| hasAnyKnownHeaders | back to summary |
|---|---|
| public static final boolean hasAnyKnownHeaders(byte[] b) Returns whether the message starts with any known headers.
| |
| headerEnd | back to summary |
|---|---|
| public static final int headerEnd(final byte[] b, int ptr)
Deprecated use { Locate the first end of header after the given position. Note that headers may be more than one line long. Also note that there might be multiple headers. If you wish to find the last header's end - call this in a loop.
| |
| headerStart | back to summary |
|---|---|
| public static final int headerStart(byte[] headerName, byte[] b, int ptr) Find the start of the contents of a given header.
| |
| headerValue | back to summary |
|---|---|
| public static final byte[] headerValue(final byte[] b, int start, int end) Extract a part of a buffer as a header value, removing the single blanks at the front of continuation lines.
| |
| lastIndexOfTrim | back to summary |
|---|---|
| public static int lastIndexOfTrim(byte[] raw, char ch, int pos) Get last index of
| |
| lineMap | back to summary |
|---|---|
| public static final IntList lineMap(byte[] buf, int ptr, int end) Index the region between
The returned list is 1 indexed. Index 0 contains
Using a 1 indexed list means that line numbers can be directly accessed
from the list, so
The last element (index
| |
| lineMapOrBinary | back to summary |
|---|---|
| public static final IntList lineMapOrBinary(byte[] buf, int ptr, int end) throws BinaryBlobException Like
| |
| match | back to summary |
|---|---|
| public static final int match(byte[] b, int ptr, byte[] src) Determine if b[ptr] matches src.
| |
| next | back to summary |
|---|---|
| public static final int next(byte[] b, int ptr, char chrA) Locate the first position after a given character.
| |
| nextLF | back to summary |
|---|---|
| public static final int nextLF(byte[] b, int ptr) Locate the first position after the next LF. This method stops on the first '\n' it finds.
| |
| nextLF | back to summary |
|---|---|
| public static final int nextLF(byte[] b, int ptr, char chrA) Locate the first position after either the given character or LF. This method stops on the first match it finds from either chrA or '\n'.
| |
| nextLfSkippingSplitLines | back to summary |
|---|---|
| public static final int nextLfSkippingSplitLines(final byte[] b, int ptr) Locate the first end of line after the given position, while treating following lines which are starting with spaces as part of the current line.
For example,
| |
| parseBase10 | back to summary |
|---|---|
| public static final int parseBase10(final byte[] b, int ptr, final MutableInteger ptrResult) Parse a base 10 numeric from a sequence of ASCII digits into an int. Digit sequences can begin with an optional run of spaces before the sequence, and may start with a '+' or a '-' to indicate sign position. Any other characters will cause the method to stop and return the current result to the caller.
| |
| parseEncoding | back to summary |
|---|---|
| public static Charset parseEncoding(byte[] b) Parse the "encoding " header into a character set reference.
Locates the "encoding " header (if present) by first calling
If no encoding header is present
| |
| parseEncodingName | back to summary |
|---|---|
| public static String parseEncodingName(byte[] b) Parse the "encoding " header as a string. Locates the "encoding " header (if present) and returns its value. | |
| parseHexInt16 | back to summary |
|---|---|
| public static final int parseHexInt16(final byte[] bs, final int p) Parse 4 character base 16 (hex) formatted string to unsigned integer. The number is read in network byte order, that is, most significant nybble first.
| |
| parseHexInt32 | back to summary |
|---|---|
| public static final int parseHexInt32(final byte[] bs, final int p) Parse 8 character base 16 (hex) formatted string to unsigned integer. The number is read in network byte order, that is, most significant nybble first.
| |
| parseHexInt4 | back to summary |
|---|---|
| public static final int parseHexInt4(final byte digit) Parse a single hex digit to its numeric value (0-15).
| |
| parseHexInt64 | back to summary |
|---|---|
| public static final long parseHexInt64(final byte[] bs, final int p) Parse 16 character base 16 (hex) formatted string to unsigned long. The number is read in network byte order, that is, most significant nibble first.
| |
| parseLongBase10 | back to summary |
|---|---|
| public static final long parseLongBase10(final byte[] b, int ptr, final MutableInteger ptrResult) Parse a base 10 numeric from a sequence of ASCII digits into a long. Digit sequences can begin with an optional run of spaces before the sequence, and may start with a '+' or a '-' to indicate sign position. Any other characters will cause the method to stop and return the current result to the caller.
| |
| parsePersonIdent | back to summary |
|---|---|
| public static PersonIdent parsePersonIdent(String in) Parse a name string (e.g. author, committer, tagger) into a PersonIdent. Leading spaces won't be trimmed from the string, i.e. will show up in the parsed name afterwards.
| |
| parsePersonIdent | back to summary |
|---|---|
| public static PersonIdent parsePersonIdent(byte[] raw, int nameB) Parse a name line (e.g. author, committer, tagger) into a PersonIdent.
When passing in a value for
| |
| parsePersonIdentOnly | back to summary |
|---|---|
| public static PersonIdent parsePersonIdentOnly(final byte[] raw, final int nameB) Parse a name data (e.g. as within a reflog) into a PersonIdent.
When passing in a value for
| |
| parseTimeZoneOffset | back to summary |
|---|---|
| public static final int parseTimeZoneOffset(byte[] b, int ptr) Parse a Git style timezone string. The sequence "-0315" will be parsed as the numeric value -195, as the lower two positions count minutes, not 100ths of an hour.
| |
| parseTimeZoneOffset | back to summary |
|---|---|
| public static final int parseTimeZoneOffset(final byte[] b, int ptr, MutableInteger ptrResult) Parse a Git style timezone string. The sequence "-0315" will be parsed as the numeric value -195, as the lower two positions count minutes, not 100ths of an hour.
| |
| parseZoneOffset | back to summary |
|---|---|
| private static ZoneId parseZoneOffset(final byte[] b, int ptr, MutableInteger ptrResult) Parse a Git style timezone string in [+-]hhmm format
| |
| prev | back to summary |
|---|---|
| public static final int prev(byte[] b, int ptr, char chrA) Locate the first position before a given character.
| |
| prevLF | back to summary |
|---|---|
| public static final int prevLF(byte[] b, int ptr) Locate the first position before the previous LF. This method stops on the first '\n' it finds.
| |
| prevLF | back to summary |
|---|---|
| public static final int prevLF(byte[] b, int ptr, char chrA) Locate the previous position before either the given character or LF. This method stops on the first match it finds from either chrA or '\n'.
| |
| tagger | back to summary |
|---|---|
| public static final int tagger(byte[] b, int ptr) Locate the "tagger " header line data.
| |
| tagMessage | back to summary |
|---|---|
| public static final int tagMessage(byte[] b, int ptr) Locate the position of the tag message body.
| |