public static long parseOctal ( byte [ ] header , int offset , int length ) throws InvalidHeaderException { long result = 0 ; boolean stillPadding = true ; int end = offset + length ; for ( int i = offset ; i < end ; ++ i ) { if ( header [ i ] == 0 ) { break ; } if ( header [ i ] == ( byte ) ' ' || header [ i ] == ' ' ) { if ( stillPadding ) { continue ; } if ( header [ i ] == ( byte ) ' ' ) { break ; } } stillPadding = false ; result = ( result << 3 ) + ( header [ i ] - ' ' ) ; } return result ; }
Parse an octal string from a header buffer . This is used for the file permission mode value .