private static void translateSeparator(final String path, final int startIdx, final int endIdx,
            final boolean stripFinalSeparator, final StringBuilder buf) {
        for (int i = startIdx; i < endIdx; i++) {
            final char c = path.charAt(i);
            if (c == '\\' || c == '/') {
                // Strip trailing separator, if necessary
                if (i < endIdx - 1 || !stripFinalSeparator) {
                    // Remove duplicate separators
                    final char prevChar = buf.length() == 0 ? '\0' : buf.charAt(buf.length() - 1);
                    if (prevChar != '/') {
                        buf.append('/');
                    }
                }
            } else {
                buf.append(c);
            }
        }
    }
private static void translateSeparator ( final String path , final int startIdx , final int endIdx , final boolean stripFinalSeparator , final StringBuilder buf ) { for ( int i = startIdx ; i < endIdx ; i ++ ) { final char c = path . charAt ( i ) ; if ( c == '\\' || c == '/' ) { if ( i < endIdx - 1 || ! stripFinalSeparator ) { final char prevChar = buf . length ( ) == 0 ? '\0' : buf . charAt ( buf . length ( ) - 1 ) ; if ( prevChar != '/' ) { buf . append ( '/' ) ; } } } else { buf . append ( c ) ; } } }
Translate backslashes to forward slashes, optionally removing trailing separator.

@param path
the path
@param startIdx
the start index
@param endIdx
the end index
@param stripFinalSeparator
if true, strip the final separator
@param buf
the buf