View Javadoc

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