View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.util;
8   
9   import java.io.File;
10  
11  public class FilenameUtils extends org.apache.commons.io.FilenameUtils
12  {
13      public static File fileWithPathComponents(String[] pathComponents)
14      {
15          if (pathComponents == null)
16          {
17              return null;
18          }
19          
20          StringBuffer buf = new StringBuffer(64);
21          for (int i = 0; i < pathComponents.length; i++)
22          {
23              String component = pathComponents[i];
24              if (component == null)
25              {
26                  continue;
27              }
28              
29              buf.append(component);
30              if (i < pathComponents.length - 1)
31              {
32                  buf.append(File.separator);
33              }
34          }
35          return FileUtils.newFile(buf.toString());
36      }
37      
38      /**
39       * Never create instances of this class.
40       */
41      private FilenameUtils()
42      {
43          super();
44      }
45  }
46  
47