static boolean matchAntPathPattern( MatchPattern matchPattern, String str, String separator, boolean isCaseSensitive ) { if ( separatorPatternStartSlashMismatch( matchPattern, str, separator ) ) { return false; } String[] patDirs = matchPattern.getTokenizedPathString(); String[] strDirs = tokenizePathToString( str, separator ); return matchAntPathPattern( patDirs, strDirs, isCaseSensitive ); }
@SuppressWarnings( "SimplifiableIfStatement" ) static boolean matchAntPathPatternStart( MatchPattern pattern, String str, String separator, boolean isCaseSensitive ) { if ( separatorPatternStartSlashMismatch( pattern, str, separator ) ) { return false; } return matchAntPathPatternStart( pattern.getTokenizedPathString(), str, separator, isCaseSensitive ); }
public static MatchPatterns from( String... sources ) { final int length = sources.length; MatchPattern[] result = new MatchPattern[length]; for ( int i = 0; i < length; i++ ) { result[i] = MatchPattern.fromString( sources[i] ); } return new MatchPatterns( result ); }
/** * Copy bytes from an <code>InputStream</code> to an <code>OutputStream</code>. */ public static void copy( final InputStream input, final OutputStream output ) throws IOException { copy( input, output, DEFAULT_BUFFER_SIZE ); }
/** * @see #split(String, String, int) */ public static String[] split( String text, String separator ) { return split( text, separator, -1 ); }
/** * @return the default excludes pattern as comma separated string. * @see DirectoryScanner#DEFAULTEXCLUDES * @see StringUtils#join(Object[], String) */ public static String getDefaultExcludesAsString() { return StringUtils.join( DirectoryScanner.DEFAULTEXCLUDES, "," ); }
/** * Get the contents of an <code>InputStream</code> as a String. The platform's default encoding is used for the * byte-to-char conversion. */ public static String toString( final InputStream input ) throws IOException { return toString( input, DEFAULT_BUFFER_SIZE ); }
/** * Tests whether or not a given path matches a given pattern. * * @param pattern The pattern to match against. Must not be <code>null</code>. * @param str The path to match, as a String. Must not be <code>null</code>. * @return <code>true</code> if the pattern matches against the string, or <code>false</code> otherwise. */ protected static boolean matchPath( String pattern, String str ) { return SelectorUtils.matchPath( pattern, str ); }
/** * Get the contents of an <code>InputStream</code> as a <code>byte[]</code>. */ public static byte[] toByteArray( final InputStream input ) throws IOException { return toByteArray( input, DEFAULT_BUFFER_SIZE ); }
/** * Copy a directory to an other one. * * @param sourceDirectory the source dir * @param destinationDirectory the target dir * @throws IOException if any */ public static void copyDirectory( File sourceDirectory, File destinationDirectory ) throws IOException { copyDirectory( sourceDirectory, destinationDirectory, "**", null ); }
private static void doCopyFile( File source, File destination ) throws IOException { // offload to operating system if supported if ( Java7Detector.isJava7() ) { doCopyFileUsingNewIO( source, destination ); } else { doCopyFileUsingLegacyIO( source, destination ); } }
static boolean matchAntPathPattern( String pattern, String str, String separator, boolean isCaseSensitive ) { if ( separatorPatternStartSlashMismatch( pattern, str, separator ) ) { return false; } String[] patDirs = tokenizePathToString( pattern, separator ); String[] strDirs = tokenizePathToString( str, separator ); return matchAntPathPattern( patDirs, strDirs, isCaseSensitive ); }
/** * Determines if the current OS matches the given OS name. * * @param name the OS name to check for * @return true if the OS matches * @since 1.0 */ public static boolean isName( String name ) { return isOs( null, name, null, null ); }
/** * Creates a {@link FastMap} with a capacity of <code>256</code> entries. */ public FastMap() { initialize( 256 ); }
/** * Equivalent to printRootCauseStackTrace(t, System.err) */ public static void printRootCauseStackTrace( Throwable t ) { printRootCauseStackTrace( t, System.err ); }
/** * Parses the specified <code>CharSequence</code> as a signed decimal <code>long</code>. * * @param chars the character sequence to parse. * @return <code>parseLong(chars, 10)</code> * @throws NumberFormatException if the specified character sequence does not contain a parsable <code>long</code>. * @see #parseLong(CharSequence, int) */ public static long parseLong( CharSequence chars ) { return parseLong( chars, 10 ); }
/** * Add's to the Exclude List the default list of SCM excludes. */ public void addSCMExcludes() { String scmexcludes[] = DirectoryScanner.DEFAULTEXCLUDES; for ( String scmexclude : scmexcludes ) { addExclude( scmexclude ); } }
/** * Serialize chars from a <code>Reader</code> to bytes on an <code>OutputStream</code>, and flush the * <code>OutputStream</code>. */ public static void copy( final Reader input, final OutputStream output ) throws IOException { copy( input, output, DEFAULT_BUFFER_SIZE ); }
/** * Determines if the current OS matches the given OS architecture. * * @param arch the OS architecture to check for * @return true if the OS matches * @since 1.0 */ public static boolean isArch( String arch ) { return isOs( null, null, arch, null ); }
/** * Copy and convert bytes from a <code>byte[]</code> to chars on a <code>Writer</code>. The platform's default * encoding is used for the byte-to-char conversion. */ public static void copy( final byte[] input, final Writer output ) throws IOException { copy( input, output, DEFAULT_BUFFER_SIZE ); }