Class RawCharUtil

java.lang.Object
org.eclipse.jgit.util.RawCharUtil

public class RawCharUtil extends Object
Utility class for character functions on raw bytes

Characters are assumed to be 8-bit US-ASCII.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final boolean[]
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    isWhitespace(byte c)
    Determine if an 8-bit US-ASCII encoded character is represents whitespace
    static int
    trimLeadingWhitespace(byte[] raw, int start, int end)
    Returns the new start point for the byte array passed in after trimming any leading whitespace characters, as determined by the isWhitespace() function.
    static int
    trimTrailingWhitespace(byte[] raw, int start, int end)
    Returns the new end point for the byte array passed in after trimming any trailing whitespace characters, as determined by the isWhitespace() function.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • WHITESPACE

      private static final boolean[] WHITESPACE
  • Constructor Details

    • RawCharUtil

      private RawCharUtil()
  • Method Details

    • isWhitespace

      public static boolean isWhitespace(byte c)
      Determine if an 8-bit US-ASCII encoded character is represents whitespace
      Parameters:
      c - the 8-bit US-ASCII encoded character
      Returns:
      true if c represents a whitespace character in 8-bit US-ASCII
    • trimTrailingWhitespace

      public static int trimTrailingWhitespace(byte[] raw, int start, int end)
      Returns the new end point for the byte array passed in after trimming any trailing whitespace characters, as determined by the isWhitespace() function. start and end are assumed to be within the bounds of raw.
      Parameters:
      raw - the byte array containing the portion to trim whitespace for
      start - the start of the section of bytes
      end - the end of the section of bytes
      Returns:
      the new end point
    • trimLeadingWhitespace

      public static int trimLeadingWhitespace(byte[] raw, int start, int end)
      Returns the new start point for the byte array passed in after trimming any leading whitespace characters, as determined by the isWhitespace() function. start and end are assumed to be within the bounds of raw.
      Parameters:
      raw - the byte array containing the portion to trim whitespace for
      start - the start of the section of bytes
      end - the end of the section of bytes
      Returns:
      the new start point