@Trivial
    private static String stripPath(String path) {
        int pathLen = path.length();

        if ( pathLen == 0 ) {
            return path;

        } else if ( pathLen == 1 ) {
            if ( path.charAt(0) == '/' ) {
                return "";
            } else {
                return path;
            }

        } else {
            if ( path.charAt(0) == '/' ) {
                if ( path.charAt(pathLen - 1) == '/' ) {
                    return path.substring(1,  pathLen - 1);
                } else {
                    return path.substring(1, pathLen);
                }
            } else {
                if ( path.charAt(pathLen - 1) == '/' ) {
                    return path.substring(0, pathLen - 1);
                } else {
                    return path;
                }
            }
        }
    }
@ Trivial private static String stripPath ( String path ) { int pathLen = path . length ( ) ; if ( pathLen == 0 ) { return path ; } else if ( pathLen == 1 ) { if ( path . charAt ( 0 ) == '/' ) { return "" ; } else { return path ; } } else { if ( path . charAt ( 0 ) == '/' ) { if ( path . charAt ( pathLen - 1 ) == '/' ) { return path . substring ( 1 , pathLen - 1 ) ; } else { return path . substring ( 1 , pathLen ) ; } } else { if ( path . charAt ( pathLen - 1 ) == '/' ) { return path . substring ( 0 , pathLen - 1 ) ; } else { return path ; } } } }
Paths used in the zip entry table are adjusted to never have a leading
slash and to never have a trailing slash.

@param path The path which is to be adjusted.

@return The path with leading and trailing slashes removed.