123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617 |
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <!-- NewPage -->
- <html lang="de">
- <head>
- <!-- Generated by javadoc -->
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>FilenameUtils (Apache Commons IO 2.6 API)</title>
- <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
- <script type="text/javascript" src="../../../../script.js"></script>
- </head>
- <body>
- <script type="text/javascript"><!--
- try {
- if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="FilenameUtils (Apache Commons IO 2.6 API)";
- }
- }
- catch(err) {
- }
- //-->
- var methods = {"i0":9,"i1":9,"i2":9,"i3":9,"i4":9,"i5":9,"i6":9,"i7":9,"i8":9,"i9":9,"i10":9,"i11":9,"i12":9,"i13":9,"i14":9,"i15":9,"i16":9,"i17":9,"i18":9,"i19":9,"i20":9,"i21":9,"i22":9,"i23":9,"i24":9,"i25":9,"i26":9,"i27":9,"i28":9,"i29":9,"i30":9,"i31":9};
- var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],8:["t4","Concrete Methods"]};
- var altColor = "altColor";
- var rowColor = "rowColor";
- var tableTab = "tableTab";
- var activeTableTab = "activeTableTab";
- </script>
- <noscript>
- <div>JavaScript is disabled on your browser.</div>
- </noscript>
- <!-- ========= START OF TOP NAVBAR ======= -->
- <div class="topNav"><a name="navbar.top">
- <!-- -->
- </a>
- <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
- <a name="navbar.top.firstrow">
- <!-- -->
- </a>
- <ul class="navList" title="Navigation">
- <li><a href="../../../../overview-summary.html">Overview</a></li>
- <li><a href="package-summary.html">Package</a></li>
- <li class="navBarCell1Rev">Class</li>
- <li><a href="class-use/FilenameUtils.html">Use</a></li>
- <li><a href="package-tree.html">Tree</a></li>
- <li><a href="../../../../deprecated-list.html">Deprecated</a></li>
- <li><a href="../../../../index-all.html">Index</a></li>
- <li><a href="../../../../help-doc.html">Help</a></li>
- </ul>
- </div>
- <div class="subNav">
- <ul class="navList">
- <li><a href="../../../../org/apache/commons/io/FileExistsException.html" title="class in org.apache.commons.io"><span class="typeNameLink">Prev Class</span></a></li>
- <li><a href="../../../../org/apache/commons/io/FileSystemUtils.html" title="class in org.apache.commons.io"><span class="typeNameLink">Next Class</span></a></li>
- </ul>
- <ul class="navList">
- <li><a href="../../../../index.html?org/apache/commons/io/FilenameUtils.html" target="_top">Frames</a></li>
- <li><a href="FilenameUtils.html" target="_top">No Frames</a></li>
- </ul>
- <ul class="navList" id="allclasses_navbar_top">
- <li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
- </ul>
- <div>
- <script type="text/javascript"><!--
- allClassesLink = document.getElementById("allclasses_navbar_top");
- if(window==top) {
- allClassesLink.style.display = "block";
- }
- else {
- allClassesLink.style.display = "none";
- }
- //-->
- </script>
- </div>
- <div>
- <ul class="subNavList">
- <li>Summary: </li>
- <li>Nested | </li>
- <li><a href="#field.summary">Field</a> | </li>
- <li><a href="#constructor.summary">Constr</a> | </li>
- <li><a href="#method.summary">Method</a></li>
- </ul>
- <ul class="subNavList">
- <li>Detail: </li>
- <li><a href="#field.detail">Field</a> | </li>
- <li><a href="#constructor.detail">Constr</a> | </li>
- <li><a href="#method.detail">Method</a></li>
- </ul>
- </div>
- <a name="skip.navbar.top">
- <!-- -->
- </a></div>
- <!-- ========= END OF TOP NAVBAR ========= -->
- <!-- ======== START OF CLASS DATA ======== -->
- <div class="header">
- <div class="subTitle">org.apache.commons.io</div>
- <h2 title="Class FilenameUtils" class="title">Class FilenameUtils</h2>
- </div>
- <div class="contentContainer">
- <ul class="inheritance">
- <li><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
- <li>
- <ul class="inheritance">
- <li>org.apache.commons.io.FilenameUtils</li>
- </ul>
- </li>
- </ul>
- <div class="description">
- <ul class="blockList">
- <li class="blockList">
- <hr>
- <br>
- <pre>public class <span class="typeNameLabel">FilenameUtils</span>
- extends <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre>
- <div class="block">General filename and filepath manipulation utilities.
- <p>
- When dealing with filenames you can hit problems when moving from a Windows
- based development machine to a Unix based production machine.
- This class aims to help avoid those problems.
- <p>
- <b>NOTE</b>: You may be able to avoid using this class entirely simply by
- using JDK <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io"><code>File</code></a> objects and the two argument constructor
- <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true#File-java.io.File-java.lang.String-" title="class or interface in java.io"><code>File(File,String)</code></a>.
- <p>
- Most methods on this class are designed to work the same on both Unix and Windows.
- Those that don't include 'System', 'Unix' or 'Windows' in their name.
- <p>
- Most methods recognise both separators (forward and back), and both
- sets of prefixes. See the javadoc of each method for details.
- <p>
- This class defines six components within a filename
- (example C:\dev\project\file.txt):
- <ul>
- <li>the prefix - C:\</li>
- <li>the path - dev\project\</li>
- <li>the full path - C:\dev\project\</li>
- <li>the name - file.txt</li>
- <li>the base name - file</li>
- <li>the extension - txt</li>
- </ul>
- Note that this class works best if directory filenames end with a separator.
- If you omit the last separator, it is impossible to determine if the filename
- corresponds to a file or a directory. As a result, we have chosen to say
- it corresponds to a file.
- <p>
- This class only supports Unix and Windows style names.
- Prefixes are matched as follows:
- <pre>
- Windows:
- a\b\c.txt --> "" --> relative
- \a\b\c.txt --> "\" --> current drive absolute
- C:a\b\c.txt --> "C:" --> drive relative
- C:\a\b\c.txt --> "C:\" --> absolute
- \\server\a\b\c.txt --> "\\server\" --> UNC
- Unix:
- a/b/c.txt --> "" --> relative
- /a/b/c.txt --> "/" --> absolute
- ~/a/b/c.txt --> "~/" --> current user
- ~ --> "~/" --> current user (slash added)
- ~user/a/b/c.txt --> "~user/" --> named user
- ~user --> "~user/" --> named user (slash added)
- </pre>
- Both prefix styles are matched always, irrespective of the machine that you are
- currently running on.
- <p>
- Origin of code: Excalibur, Alexandria, Tomcat, Commons-Utils.</div>
- <dl>
- <dt><span class="simpleTagLabel">Since:</span></dt>
- <dd>1.1</dd>
- </dl>
- </li>
- </ul>
- </div>
- <div class="summary">
- <ul class="blockList">
- <li class="blockList">
- <!-- =========== FIELD SUMMARY =========== -->
- <ul class="blockList">
- <li class="blockList"><a name="field.summary">
- <!-- -->
- </a>
- <h3>Field Summary</h3>
- <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
- <caption><span>Fields</span><span class="tabEnd"> </span></caption>
- <tr>
- <th class="colFirst" scope="col">Modifier and Type</th>
- <th class="colLast" scope="col">Field and Description</th>
- </tr>
- <tr class="altColor">
- <td class="colFirst"><code>static char</code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#EXTENSION_SEPARATOR">EXTENSION_SEPARATOR</a></span></code>
- <div class="block">The extension separator character.</div>
- </td>
- </tr>
- <tr class="rowColor">
- <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#EXTENSION_SEPARATOR_STR">EXTENSION_SEPARATOR_STR</a></span></code>
- <div class="block">The extension separator String.</div>
- </td>
- </tr>
- </table>
- </li>
- </ul>
- <!-- ======== CONSTRUCTOR SUMMARY ======== -->
- <ul class="blockList">
- <li class="blockList"><a name="constructor.summary">
- <!-- -->
- </a>
- <h3>Constructor Summary</h3>
- <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
- <caption><span>Constructors</span><span class="tabEnd"> </span></caption>
- <tr>
- <th class="colOne" scope="col">Constructor and Description</th>
- </tr>
- <tr class="altColor">
- <td class="colOne"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#FilenameUtils--">FilenameUtils</a></span>()</code>
- <div class="block">Instances should NOT be constructed in standard programming.</div>
- </td>
- </tr>
- </table>
- </li>
- </ul>
- <!-- ========== METHOD SUMMARY =========== -->
- <ul class="blockList">
- <li class="blockList"><a name="method.summary">
- <!-- -->
- </a>
- <h3>Method Summary</h3>
- <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
- <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption>
- <tr>
- <th class="colFirst" scope="col">Modifier and Type</th>
- <th class="colLast" scope="col">Method and Description</th>
- </tr>
- <tr id="i0" class="altColor">
- <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#concat-java.lang.String-java.lang.String-">concat</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> basePath,
- <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> fullFilenameToAdd)</code>
- <div class="block">Concatenates a filename to a base path using normal command line style rules.</div>
- </td>
- </tr>
- <tr id="i1" class="rowColor">
- <td class="colFirst"><code>static boolean</code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#directoryContains-java.lang.String-java.lang.String-">directoryContains</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> canonicalParent,
- <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> canonicalChild)</code>
- <div class="block">Determines whether the <code>parent</code> directory contains the <code>child</code> element (a file or directory).</div>
- </td>
- </tr>
- <tr id="i2" class="altColor">
- <td class="colFirst"><code>static boolean</code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#equals-java.lang.String-java.lang.String-">equals</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename1,
- <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename2)</code>
- <div class="block">Checks whether two filenames are equal exactly.</div>
- </td>
- </tr>
- <tr id="i3" class="rowColor">
- <td class="colFirst"><code>static boolean</code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#equals-java.lang.String-java.lang.String-boolean-org.apache.commons.io.IOCase-">equals</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename1,
- <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename2,
- boolean normalized,
- <a href="../../../../org/apache/commons/io/IOCase.html" title="enum in org.apache.commons.io">IOCase</a> caseSensitivity)</code>
- <div class="block">Checks whether two filenames are equal, optionally normalizing and providing
- control over the case-sensitivity.</div>
- </td>
- </tr>
- <tr id="i4" class="altColor">
- <td class="colFirst"><code>static boolean</code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#equalsNormalized-java.lang.String-java.lang.String-">equalsNormalized</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename1,
- <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename2)</code>
- <div class="block">Checks whether two filenames are equal after both have been normalized.</div>
- </td>
- </tr>
- <tr id="i5" class="rowColor">
- <td class="colFirst"><code>static boolean</code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#equalsNormalizedOnSystem-java.lang.String-java.lang.String-">equalsNormalizedOnSystem</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename1,
- <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename2)</code>
- <div class="block">Checks whether two filenames are equal after both have been normalized
- and using the case rules of the system.</div>
- </td>
- </tr>
- <tr id="i6" class="altColor">
- <td class="colFirst"><code>static boolean</code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#equalsOnSystem-java.lang.String-java.lang.String-">equalsOnSystem</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename1,
- <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename2)</code>
- <div class="block">Checks whether two filenames are equal using the case rules of the system.</div>
- </td>
- </tr>
- <tr id="i7" class="rowColor">
- <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#getBaseName-java.lang.String-">getBaseName</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename)</code>
- <div class="block">Gets the base name, minus the full path and extension, from a full filename.</div>
- </td>
- </tr>
- <tr id="i8" class="altColor">
- <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#getExtension-java.lang.String-">getExtension</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename)</code>
- <div class="block">Gets the extension of a filename.</div>
- </td>
- </tr>
- <tr id="i9" class="rowColor">
- <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#getFullPath-java.lang.String-">getFullPath</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename)</code>
- <div class="block">Gets the full path from a full filename, which is the prefix + path.</div>
- </td>
- </tr>
- <tr id="i10" class="altColor">
- <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#getFullPathNoEndSeparator-java.lang.String-">getFullPathNoEndSeparator</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename)</code>
- <div class="block">Gets the full path from a full filename, which is the prefix + path,
- and also excluding the final directory separator.</div>
- </td>
- </tr>
- <tr id="i11" class="rowColor">
- <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#getName-java.lang.String-">getName</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename)</code>
- <div class="block">Gets the name minus the path from a full filename.</div>
- </td>
- </tr>
- <tr id="i12" class="altColor">
- <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#getPath-java.lang.String-">getPath</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename)</code>
- <div class="block">Gets the path from a full filename, which excludes the prefix.</div>
- </td>
- </tr>
- <tr id="i13" class="rowColor">
- <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#getPathNoEndSeparator-java.lang.String-">getPathNoEndSeparator</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename)</code>
- <div class="block">Gets the path from a full filename, which excludes the prefix, and
- also excluding the final directory separator.</div>
- </td>
- </tr>
- <tr id="i14" class="altColor">
- <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#getPrefix-java.lang.String-">getPrefix</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename)</code>
- <div class="block">Gets the prefix from a full filename, such as <code>C:/</code>
- or <code>~/</code>.</div>
- </td>
- </tr>
- <tr id="i15" class="rowColor">
- <td class="colFirst"><code>static int</code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#getPrefixLength-java.lang.String-">getPrefixLength</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename)</code>
- <div class="block">Returns the length of the filename prefix, such as <code>C:/</code> or <code>~/</code>.</div>
- </td>
- </tr>
- <tr id="i16" class="altColor">
- <td class="colFirst"><code>static int</code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#indexOfExtension-java.lang.String-">indexOfExtension</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename)</code>
- <div class="block">Returns the index of the last extension separator character, which is a dot.</div>
- </td>
- </tr>
- <tr id="i17" class="rowColor">
- <td class="colFirst"><code>static int</code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#indexOfLastSeparator-java.lang.String-">indexOfLastSeparator</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename)</code>
- <div class="block">Returns the index of the last directory separator character.</div>
- </td>
- </tr>
- <tr id="i18" class="altColor">
- <td class="colFirst"><code>static boolean</code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#isExtension-java.lang.String-java.util.Collection-">isExtension</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename,
- <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>> extensions)</code>
- <div class="block">Checks whether the extension of the filename is one of those specified.</div>
- </td>
- </tr>
- <tr id="i19" class="rowColor">
- <td class="colFirst"><code>static boolean</code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#isExtension-java.lang.String-java.lang.String-">isExtension</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename,
- <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> extension)</code>
- <div class="block">Checks whether the extension of the filename is that specified.</div>
- </td>
- </tr>
- <tr id="i20" class="altColor">
- <td class="colFirst"><code>static boolean</code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#isExtension-java.lang.String-java.lang.String:A-">isExtension</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename,
- <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[] extensions)</code>
- <div class="block">Checks whether the extension of the filename is one of those specified.</div>
- </td>
- </tr>
- <tr id="i21" class="rowColor">
- <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#normalize-java.lang.String-">normalize</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename)</code>
- <div class="block">Normalizes a path, removing double and single dot path steps.</div>
- </td>
- </tr>
- <tr id="i22" class="altColor">
- <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#normalize-java.lang.String-boolean-">normalize</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename,
- boolean unixSeparator)</code>
- <div class="block">Normalizes a path, removing double and single dot path steps.</div>
- </td>
- </tr>
- <tr id="i23" class="rowColor">
- <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#normalizeNoEndSeparator-java.lang.String-">normalizeNoEndSeparator</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename)</code>
- <div class="block">Normalizes a path, removing double and single dot path steps,
- and removing any final directory separator.</div>
- </td>
- </tr>
- <tr id="i24" class="altColor">
- <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#normalizeNoEndSeparator-java.lang.String-boolean-">normalizeNoEndSeparator</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename,
- boolean unixSeparator)</code>
- <div class="block">Normalizes a path, removing double and single dot path steps,
- and removing any final directory separator.</div>
- </td>
- </tr>
- <tr id="i25" class="rowColor">
- <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#removeExtension-java.lang.String-">removeExtension</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename)</code>
- <div class="block">Removes the extension from a filename.</div>
- </td>
- </tr>
- <tr id="i26" class="altColor">
- <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#separatorsToSystem-java.lang.String-">separatorsToSystem</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> path)</code>
- <div class="block">Converts all separators to the system separator.</div>
- </td>
- </tr>
- <tr id="i27" class="rowColor">
- <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#separatorsToUnix-java.lang.String-">separatorsToUnix</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> path)</code>
- <div class="block">Converts all separators to the Unix separator of forward slash.</div>
- </td>
- </tr>
- <tr id="i28" class="altColor">
- <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#separatorsToWindows-java.lang.String-">separatorsToWindows</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> path)</code>
- <div class="block">Converts all separators to the Windows separator of backslash.</div>
- </td>
- </tr>
- <tr id="i29" class="rowColor">
- <td class="colFirst"><code>static boolean</code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#wildcardMatch-java.lang.String-java.lang.String-">wildcardMatch</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename,
- <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> wildcardMatcher)</code>
- <div class="block">Checks a filename to see if it matches the specified wildcard matcher,
- always testing case-sensitive.</div>
- </td>
- </tr>
- <tr id="i30" class="altColor">
- <td class="colFirst"><code>static boolean</code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#wildcardMatch-java.lang.String-java.lang.String-org.apache.commons.io.IOCase-">wildcardMatch</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename,
- <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> wildcardMatcher,
- <a href="../../../../org/apache/commons/io/IOCase.html" title="enum in org.apache.commons.io">IOCase</a> caseSensitivity)</code>
- <div class="block">Checks a filename to see if it matches the specified wildcard matcher
- allowing control over case-sensitivity.</div>
- </td>
- </tr>
- <tr id="i31" class="rowColor">
- <td class="colFirst"><code>static boolean</code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FilenameUtils.html#wildcardMatchOnSystem-java.lang.String-java.lang.String-">wildcardMatchOnSystem</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename,
- <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> wildcardMatcher)</code>
- <div class="block">Checks a filename to see if it matches the specified wildcard matcher
- using the case rules of the system.</div>
- </td>
- </tr>
- </table>
- <ul class="blockList">
- <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
- <!-- -->
- </a>
- <h3>Methods inherited from class java.lang.<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
- <code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- </div>
- <div class="details">
- <ul class="blockList">
- <li class="blockList">
- <!-- ============ FIELD DETAIL =========== -->
- <ul class="blockList">
- <li class="blockList"><a name="field.detail">
- <!-- -->
- </a>
- <h3>Field Detail</h3>
- <a name="EXTENSION_SEPARATOR">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>EXTENSION_SEPARATOR</h4>
- <pre>public static final char EXTENSION_SEPARATOR</pre>
- <div class="block">The extension separator character.</div>
- <dl>
- <dt><span class="simpleTagLabel">Since:</span></dt>
- <dd>1.4</dd>
- <dt><span class="seeLabel">See Also:</span></dt>
- <dd><a href="../../../../constant-values.html#org.apache.commons.io.FilenameUtils.EXTENSION_SEPARATOR">Constant Field Values</a></dd>
- </dl>
- </li>
- </ul>
- <a name="EXTENSION_SEPARATOR_STR">
- <!-- -->
- </a>
- <ul class="blockListLast">
- <li class="blockList">
- <h4>EXTENSION_SEPARATOR_STR</h4>
- <pre>public static final <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> EXTENSION_SEPARATOR_STR</pre>
- <div class="block">The extension separator String.</div>
- <dl>
- <dt><span class="simpleTagLabel">Since:</span></dt>
- <dd>1.4</dd>
- </dl>
- </li>
- </ul>
- </li>
- </ul>
- <!-- ========= CONSTRUCTOR DETAIL ======== -->
- <ul class="blockList">
- <li class="blockList"><a name="constructor.detail">
- <!-- -->
- </a>
- <h3>Constructor Detail</h3>
- <a name="FilenameUtils--">
- <!-- -->
- </a>
- <ul class="blockListLast">
- <li class="blockList">
- <h4>FilenameUtils</h4>
- <pre>public FilenameUtils()</pre>
- <div class="block">Instances should NOT be constructed in standard programming.</div>
- </li>
- </ul>
- </li>
- </ul>
- <!-- ============ METHOD DETAIL ========== -->
- <ul class="blockList">
- <li class="blockList"><a name="method.detail">
- <!-- -->
- </a>
- <h3>Method Detail</h3>
- <a name="normalize-java.lang.String-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>normalize</h4>
- <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> normalize(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename)</pre>
- <div class="block">Normalizes a path, removing double and single dot path steps.
- <p>
- This method normalizes a path to a standard format.
- The input may contain separators in either Unix or Windows format.
- The output will contain separators in the format of the system.
- <p>
- A trailing slash will be retained.
- A double slash will be merged to a single slash (but UNC names are handled).
- A single dot path segment will be removed.
- A double dot will cause that path segment and the one before to be removed.
- If the double dot has no parent path segment to work with, <code>null</code>
- is returned.
- <p>
- The output will be the same on both Unix and Windows except
- for the separator character.
- <pre>
- /foo// --> /foo/
- /foo/./ --> /foo/
- /foo/../bar --> /bar
- /foo/../bar/ --> /bar/
- /foo/../bar/../baz --> /baz
- //foo//./bar --> /foo/bar
- /../ --> null
- ../foo --> null
- foo/bar/.. --> foo/
- foo/../../bar --> null
- foo/../bar --> bar
- //server/foo/../bar --> //server/bar
- //server/../bar --> null
- C:\foo\..\bar --> C:\bar
- C:\..\bar --> null
- ~/foo/../bar/ --> ~/bar/
- ~/../bar --> null
- </pre>
- (Note the file separator returned will be correct for Windows/Unix)</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>filename</code> - the filename to normalize, null returns null</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>the normalized filename, or null if invalid. Null bytes inside string will be removed</dd>
- </dl>
- </li>
- </ul>
- <a name="normalize-java.lang.String-boolean-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>normalize</h4>
- <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> normalize(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename,
- boolean unixSeparator)</pre>
- <div class="block">Normalizes a path, removing double and single dot path steps.
- <p>
- This method normalizes a path to a standard format.
- The input may contain separators in either Unix or Windows format.
- The output will contain separators in the format specified.
- <p>
- A trailing slash will be retained.
- A double slash will be merged to a single slash (but UNC names are handled).
- A single dot path segment will be removed.
- A double dot will cause that path segment and the one before to be removed.
- If the double dot has no parent path segment to work with, <code>null</code>
- is returned.
- <p>
- The output will be the same on both Unix and Windows except
- for the separator character.
- <pre>
- /foo// --> /foo/
- /foo/./ --> /foo/
- /foo/../bar --> /bar
- /foo/../bar/ --> /bar/
- /foo/../bar/../baz --> /baz
- //foo//./bar --> /foo/bar
- /../ --> null
- ../foo --> null
- foo/bar/.. --> foo/
- foo/../../bar --> null
- foo/../bar --> bar
- //server/foo/../bar --> //server/bar
- //server/../bar --> null
- C:\foo\..\bar --> C:\bar
- C:\..\bar --> null
- ~/foo/../bar/ --> ~/bar/
- ~/../bar --> null
- </pre>
- The output will be the same on both Unix and Windows including
- the separator character.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>filename</code> - the filename to normalize, null returns null</dd>
- <dd><code>unixSeparator</code> - <code>true</code> if a unix separator should
- be used or <code>false</code> if a windows separator should be used.</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>the normalized filename, or null if invalid. Null bytes inside string will be removed</dd>
- <dt><span class="simpleTagLabel">Since:</span></dt>
- <dd>2.0</dd>
- </dl>
- </li>
- </ul>
- <a name="normalizeNoEndSeparator-java.lang.String-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>normalizeNoEndSeparator</h4>
- <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> normalizeNoEndSeparator(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename)</pre>
- <div class="block">Normalizes a path, removing double and single dot path steps,
- and removing any final directory separator.
- <p>
- This method normalizes a path to a standard format.
- The input may contain separators in either Unix or Windows format.
- The output will contain separators in the format of the system.
- <p>
- A trailing slash will be removed.
- A double slash will be merged to a single slash (but UNC names are handled).
- A single dot path segment will be removed.
- A double dot will cause that path segment and the one before to be removed.
- If the double dot has no parent path segment to work with, <code>null</code>
- is returned.
- <p>
- The output will be the same on both Unix and Windows except
- for the separator character.
- <pre>
- /foo// --> /foo
- /foo/./ --> /foo
- /foo/../bar --> /bar
- /foo/../bar/ --> /bar
- /foo/../bar/../baz --> /baz
- //foo//./bar --> /foo/bar
- /../ --> null
- ../foo --> null
- foo/bar/.. --> foo
- foo/../../bar --> null
- foo/../bar --> bar
- //server/foo/../bar --> //server/bar
- //server/../bar --> null
- C:\foo\..\bar --> C:\bar
- C:\..\bar --> null
- ~/foo/../bar/ --> ~/bar
- ~/../bar --> null
- </pre>
- (Note the file separator returned will be correct for Windows/Unix)</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>filename</code> - the filename to normalize, null returns null</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>the normalized filename, or null if invalid. Null bytes inside string will be removed</dd>
- </dl>
- </li>
- </ul>
- <a name="normalizeNoEndSeparator-java.lang.String-boolean-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>normalizeNoEndSeparator</h4>
- <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> normalizeNoEndSeparator(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename,
- boolean unixSeparator)</pre>
- <div class="block">Normalizes a path, removing double and single dot path steps,
- and removing any final directory separator.
- <p>
- This method normalizes a path to a standard format.
- The input may contain separators in either Unix or Windows format.
- The output will contain separators in the format specified.
- <p>
- A trailing slash will be removed.
- A double slash will be merged to a single slash (but UNC names are handled).
- A single dot path segment will be removed.
- A double dot will cause that path segment and the one before to be removed.
- If the double dot has no parent path segment to work with, <code>null</code>
- is returned.
- <p>
- The output will be the same on both Unix and Windows including
- the separator character.
- <pre>
- /foo// --> /foo
- /foo/./ --> /foo
- /foo/../bar --> /bar
- /foo/../bar/ --> /bar
- /foo/../bar/../baz --> /baz
- //foo//./bar --> /foo/bar
- /../ --> null
- ../foo --> null
- foo/bar/.. --> foo
- foo/../../bar --> null
- foo/../bar --> bar
- //server/foo/../bar --> //server/bar
- //server/../bar --> null
- C:\foo\..\bar --> C:\bar
- C:\..\bar --> null
- ~/foo/../bar/ --> ~/bar
- ~/../bar --> null
- </pre></div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>filename</code> - the filename to normalize, null returns null</dd>
- <dd><code>unixSeparator</code> - <code>true</code> if a unix separator should
- be used or <code>false</code> if a windows separator should be used.</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>the normalized filename, or null if invalid. Null bytes inside string will be removed</dd>
- <dt><span class="simpleTagLabel">Since:</span></dt>
- <dd>2.0</dd>
- </dl>
- </li>
- </ul>
- <a name="concat-java.lang.String-java.lang.String-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>concat</h4>
- <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> concat(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> basePath,
- <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> fullFilenameToAdd)</pre>
- <div class="block">Concatenates a filename to a base path using normal command line style rules.
- <p>
- The effect is equivalent to resultant directory after changing
- directory to the first argument, followed by changing directory to
- the second argument.
- <p>
- The first argument is the base path, the second is the path to concatenate.
- The returned path is always normalized via <a href="../../../../org/apache/commons/io/FilenameUtils.html#normalize-java.lang.String-"><code>normalize(String)</code></a>,
- thus <code>..</code> is handled.
- <p>
- If <code>pathToAdd</code> is absolute (has an absolute prefix), then
- it will be normalized and returned.
- Otherwise, the paths will be joined, normalized and returned.
- <p>
- The output will be the same on both Unix and Windows except
- for the separator character.
- <pre>
- /foo/ + bar --> /foo/bar
- /foo + bar --> /foo/bar
- /foo + /bar --> /bar
- /foo + C:/bar --> C:/bar
- /foo + C:bar --> C:bar (*)
- /foo/a/ + ../bar --> foo/bar
- /foo/ + ../../bar --> null
- /foo/ + /bar --> /bar
- /foo/.. + /bar --> /bar
- /foo + bar/c.txt --> /foo/bar/c.txt
- /foo/c.txt + bar --> /foo/c.txt/bar (!)
- </pre>
- (*) Note that the Windows relative drive prefix is unreliable when
- used with this method.
- (!) Note that the first parameter must be a path. If it ends with a name, then
- the name will be built into the concatenated path. If this might be a problem,
- use <a href="../../../../org/apache/commons/io/FilenameUtils.html#getFullPath-java.lang.String-"><code>getFullPath(String)</code></a> on the base path argument.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>basePath</code> - the base path to attach to, always treated as a path</dd>
- <dd><code>fullFilenameToAdd</code> - the filename (or path) to attach to the base</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>the concatenated path, or null if invalid. Null bytes inside string will be removed</dd>
- </dl>
- </li>
- </ul>
- <a name="directoryContains-java.lang.String-java.lang.String-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>directoryContains</h4>
- <pre>public static boolean directoryContains(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> canonicalParent,
- <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> canonicalChild)
- throws <a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
- <div class="block">Determines whether the <code>parent</code> directory contains the <code>child</code> element (a file or directory).
- <p>
- The files names are expected to be normalized.
- </p>
- Edge cases:
- <ul>
- <li>A <code>directory</code> must not be null: if null, throw IllegalArgumentException</li>
- <li>A directory does not contain itself: return false</li>
- <li>A null child file is not contained in any parent: return false</li>
- </ul></div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>canonicalParent</code> - the file to consider as the parent.</dd>
- <dd><code>canonicalChild</code> - the file to consider as the child.</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>true is the candidate leaf is under by the specified composite. False otherwise.</dd>
- <dt><span class="throwsLabel">Throws:</span></dt>
- <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - if an IO error occurs while checking the files.</dd>
- <dt><span class="simpleTagLabel">Since:</span></dt>
- <dd>2.2</dd>
- <dt><span class="seeLabel">See Also:</span></dt>
- <dd><a href="../../../../org/apache/commons/io/FileUtils.html#directoryContains-java.io.File-java.io.File-"><code>FileUtils.directoryContains(File, File)</code></a></dd>
- </dl>
- </li>
- </ul>
- <a name="separatorsToUnix-java.lang.String-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>separatorsToUnix</h4>
- <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> separatorsToUnix(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> path)</pre>
- <div class="block">Converts all separators to the Unix separator of forward slash.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>path</code> - the path to be changed, null ignored</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>the updated path</dd>
- </dl>
- </li>
- </ul>
- <a name="separatorsToWindows-java.lang.String-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>separatorsToWindows</h4>
- <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> separatorsToWindows(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> path)</pre>
- <div class="block">Converts all separators to the Windows separator of backslash.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>path</code> - the path to be changed, null ignored</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>the updated path</dd>
- </dl>
- </li>
- </ul>
- <a name="separatorsToSystem-java.lang.String-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>separatorsToSystem</h4>
- <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> separatorsToSystem(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> path)</pre>
- <div class="block">Converts all separators to the system separator.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>path</code> - the path to be changed, null ignored</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>the updated path</dd>
- </dl>
- </li>
- </ul>
- <a name="getPrefixLength-java.lang.String-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getPrefixLength</h4>
- <pre>public static int getPrefixLength(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename)</pre>
- <div class="block">Returns the length of the filename prefix, such as <code>C:/</code> or <code>~/</code>.
- <p>
- This method will handle a file in either Unix or Windows format.
- <p>
- The prefix length includes the first slash in the full filename
- if applicable. Thus, it is possible that the length returned is greater
- than the length of the input string.
- <pre>
- Windows:
- a\b\c.txt --> "" --> relative
- \a\b\c.txt --> "\" --> current drive absolute
- C:a\b\c.txt --> "C:" --> drive relative
- C:\a\b\c.txt --> "C:\" --> absolute
- \\server\a\b\c.txt --> "\\server\" --> UNC
- \\\a\b\c.txt --> error, length = -1
- Unix:
- a/b/c.txt --> "" --> relative
- /a/b/c.txt --> "/" --> absolute
- ~/a/b/c.txt --> "~/" --> current user
- ~ --> "~/" --> current user (slash added)
- ~user/a/b/c.txt --> "~user/" --> named user
- ~user --> "~user/" --> named user (slash added)
- //server/a/b/c.txt --> "//server/"
- ///a/b/c.txt --> error, length = -1
- </pre>
- <p>
- The output will be the same irrespective of the machine that the code is running on.
- ie. both Unix and Windows prefixes are matched regardless.
- Note that a leading // (or \\) is used to indicate a UNC name on Windows.
- These must be followed by a server name, so double-slashes are not collapsed
- to a single slash at the start of the filename.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>filename</code> - the filename to find the prefix in, null returns -1</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>the length of the prefix, -1 if invalid or null</dd>
- </dl>
- </li>
- </ul>
- <a name="indexOfLastSeparator-java.lang.String-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>indexOfLastSeparator</h4>
- <pre>public static int indexOfLastSeparator(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename)</pre>
- <div class="block">Returns the index of the last directory separator character.
- <p>
- This method will handle a file in either Unix or Windows format.
- The position of the last forward or backslash is returned.
- <p>
- The output will be the same irrespective of the machine that the code is running on.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>filename</code> - the filename to find the last path separator in, null returns -1</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>the index of the last separator character, or -1 if there
- is no such character</dd>
- </dl>
- </li>
- </ul>
- <a name="indexOfExtension-java.lang.String-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>indexOfExtension</h4>
- <pre>public static int indexOfExtension(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename)</pre>
- <div class="block">Returns the index of the last extension separator character, which is a dot.
- <p>
- This method also checks that there is no directory separator after the last dot. To do this it uses
- <a href="../../../../org/apache/commons/io/FilenameUtils.html#indexOfLastSeparator-java.lang.String-"><code>indexOfLastSeparator(String)</code></a> which will handle a file in either Unix or Windows format.
- </p>
- <p>
- The output will be the same irrespective of the machine that the code is running on.
- </p></div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>filename</code> - the filename to find the last extension separator in, null returns -1</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>the index of the last extension separator character, or -1 if there is no such character</dd>
- </dl>
- </li>
- </ul>
- <a name="getPrefix-java.lang.String-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getPrefix</h4>
- <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> getPrefix(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename)</pre>
- <div class="block">Gets the prefix from a full filename, such as <code>C:/</code>
- or <code>~/</code>.
- <p>
- This method will handle a file in either Unix or Windows format.
- The prefix includes the first slash in the full filename where applicable.
- <pre>
- Windows:
- a\b\c.txt --> "" --> relative
- \a\b\c.txt --> "\" --> current drive absolute
- C:a\b\c.txt --> "C:" --> drive relative
- C:\a\b\c.txt --> "C:\" --> absolute
- \\server\a\b\c.txt --> "\\server\" --> UNC
- Unix:
- a/b/c.txt --> "" --> relative
- /a/b/c.txt --> "/" --> absolute
- ~/a/b/c.txt --> "~/" --> current user
- ~ --> "~/" --> current user (slash added)
- ~user/a/b/c.txt --> "~user/" --> named user
- ~user --> "~user/" --> named user (slash added)
- </pre>
- <p>
- The output will be the same irrespective of the machine that the code is running on.
- ie. both Unix and Windows prefixes are matched regardless.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>filename</code> - the filename to query, null returns null</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>the prefix of the file, null if invalid. Null bytes inside string will be removed</dd>
- </dl>
- </li>
- </ul>
- <a name="getPath-java.lang.String-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getPath</h4>
- <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> getPath(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename)</pre>
- <div class="block">Gets the path from a full filename, which excludes the prefix.
- <p>
- This method will handle a file in either Unix or Windows format.
- The method is entirely text based, and returns the text before and
- including the last forward or backslash.
- <pre>
- C:\a\b\c.txt --> a\b\
- ~/a/b/c.txt --> a/b/
- a.txt --> ""
- a/b/c --> a/b/
- a/b/c/ --> a/b/c/
- </pre>
- <p>
- The output will be the same irrespective of the machine that the code is running on.
- <p>
- This method drops the prefix from the result.
- See <a href="../../../../org/apache/commons/io/FilenameUtils.html#getFullPath-java.lang.String-"><code>getFullPath(String)</code></a> for the method that retains the prefix.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>filename</code> - the filename to query, null returns null</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>the path of the file, an empty string if none exists, null if invalid.
- Null bytes inside string will be removed</dd>
- </dl>
- </li>
- </ul>
- <a name="getPathNoEndSeparator-java.lang.String-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getPathNoEndSeparator</h4>
- <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> getPathNoEndSeparator(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename)</pre>
- <div class="block">Gets the path from a full filename, which excludes the prefix, and
- also excluding the final directory separator.
- <p>
- This method will handle a file in either Unix or Windows format.
- The method is entirely text based, and returns the text before the
- last forward or backslash.
- <pre>
- C:\a\b\c.txt --> a\b
- ~/a/b/c.txt --> a/b
- a.txt --> ""
- a/b/c --> a/b
- a/b/c/ --> a/b/c
- </pre>
- <p>
- The output will be the same irrespective of the machine that the code is running on.
- <p>
- This method drops the prefix from the result.
- See <a href="../../../../org/apache/commons/io/FilenameUtils.html#getFullPathNoEndSeparator-java.lang.String-"><code>getFullPathNoEndSeparator(String)</code></a> for the method that retains the prefix.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>filename</code> - the filename to query, null returns null</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>the path of the file, an empty string if none exists, null if invalid.
- Null bytes inside string will be removed</dd>
- </dl>
- </li>
- </ul>
- <a name="getFullPath-java.lang.String-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getFullPath</h4>
- <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> getFullPath(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename)</pre>
- <div class="block">Gets the full path from a full filename, which is the prefix + path.
- <p>
- This method will handle a file in either Unix or Windows format.
- The method is entirely text based, and returns the text before and
- including the last forward or backslash.
- <pre>
- C:\a\b\c.txt --> C:\a\b\
- ~/a/b/c.txt --> ~/a/b/
- a.txt --> ""
- a/b/c --> a/b/
- a/b/c/ --> a/b/c/
- C: --> C:
- C:\ --> C:\
- ~ --> ~/
- ~/ --> ~/
- ~user --> ~user/
- ~user/ --> ~user/
- </pre>
- <p>
- The output will be the same irrespective of the machine that the code is running on.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>filename</code> - the filename to query, null returns null</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>the path of the file, an empty string if none exists, null if invalid</dd>
- </dl>
- </li>
- </ul>
- <a name="getFullPathNoEndSeparator-java.lang.String-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getFullPathNoEndSeparator</h4>
- <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> getFullPathNoEndSeparator(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename)</pre>
- <div class="block">Gets the full path from a full filename, which is the prefix + path,
- and also excluding the final directory separator.
- <p>
- This method will handle a file in either Unix or Windows format.
- The method is entirely text based, and returns the text before the
- last forward or backslash.
- <pre>
- C:\a\b\c.txt --> C:\a\b
- ~/a/b/c.txt --> ~/a/b
- a.txt --> ""
- a/b/c --> a/b
- a/b/c/ --> a/b/c
- C: --> C:
- C:\ --> C:\
- ~ --> ~
- ~/ --> ~
- ~user --> ~user
- ~user/ --> ~user
- </pre>
- <p>
- The output will be the same irrespective of the machine that the code is running on.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>filename</code> - the filename to query, null returns null</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>the path of the file, an empty string if none exists, null if invalid</dd>
- </dl>
- </li>
- </ul>
- <a name="getName-java.lang.String-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getName</h4>
- <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> getName(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename)</pre>
- <div class="block">Gets the name minus the path from a full filename.
- <p>
- This method will handle a file in either Unix or Windows format.
- The text after the last forward or backslash is returned.
- <pre>
- a/b/c.txt --> c.txt
- a.txt --> a.txt
- a/b/c --> c
- a/b/c/ --> ""
- </pre>
- <p>
- The output will be the same irrespective of the machine that the code is running on.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>filename</code> - the filename to query, null returns null</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>the name of the file without the path, or an empty string if none exists.
- Null bytes inside string will be removed</dd>
- </dl>
- </li>
- </ul>
- <a name="getBaseName-java.lang.String-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getBaseName</h4>
- <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> getBaseName(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename)</pre>
- <div class="block">Gets the base name, minus the full path and extension, from a full filename.
- <p>
- This method will handle a file in either Unix or Windows format.
- The text after the last forward or backslash and before the last dot is returned.
- <pre>
- a/b/c.txt --> c
- a.txt --> a
- a/b/c --> c
- a/b/c/ --> ""
- </pre>
- <p>
- The output will be the same irrespective of the machine that the code is running on.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>filename</code> - the filename to query, null returns null</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>the name of the file without the path, or an empty string if none exists. Null bytes inside string
- will be removed</dd>
- </dl>
- </li>
- </ul>
- <a name="getExtension-java.lang.String-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getExtension</h4>
- <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> getExtension(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename)</pre>
- <div class="block">Gets the extension of a filename.
- <p>
- This method returns the textual part of the filename after the last dot.
- There must be no directory separator after the dot.
- <pre>
- foo.txt --> "txt"
- a/b/c.jpg --> "jpg"
- a/b.txt/c --> ""
- a/b/c --> ""
- </pre>
- <p>
- The output will be the same irrespective of the machine that the code is running on.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>filename</code> - the filename to retrieve the extension of.</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>the extension of the file or an empty string if none exists or <code>null</code>
- if the filename is <code>null</code>.</dd>
- </dl>
- </li>
- </ul>
- <a name="removeExtension-java.lang.String-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>removeExtension</h4>
- <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> removeExtension(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename)</pre>
- <div class="block">Removes the extension from a filename.
- <p>
- This method returns the textual part of the filename before the last dot.
- There must be no directory separator after the dot.
- <pre>
- foo.txt --> foo
- a\b\c.jpg --> a\b\c
- a\b\c --> a\b\c
- a.b\c --> a.b\c
- </pre>
- <p>
- The output will be the same irrespective of the machine that the code is running on.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>filename</code> - the filename to query, null returns null</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>the filename minus the extension</dd>
- </dl>
- </li>
- </ul>
- <a name="equals-java.lang.String-java.lang.String-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>equals</h4>
- <pre>public static boolean equals(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename1,
- <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename2)</pre>
- <div class="block">Checks whether two filenames are equal exactly.
- <p>
- No processing is performed on the filenames other than comparison,
- thus this is merely a null-safe case-sensitive equals.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>filename1</code> - the first filename to query, may be null</dd>
- <dd><code>filename2</code> - the second filename to query, may be null</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>true if the filenames are equal, null equals null</dd>
- <dt><span class="seeLabel">See Also:</span></dt>
- <dd><a href="../../../../org/apache/commons/io/IOCase.html#SENSITIVE"><code>IOCase.SENSITIVE</code></a></dd>
- </dl>
- </li>
- </ul>
- <a name="equalsOnSystem-java.lang.String-java.lang.String-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>equalsOnSystem</h4>
- <pre>public static boolean equalsOnSystem(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename1,
- <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename2)</pre>
- <div class="block">Checks whether two filenames are equal using the case rules of the system.
- <p>
- No processing is performed on the filenames other than comparison.
- The check is case-sensitive on Unix and case-insensitive on Windows.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>filename1</code> - the first filename to query, may be null</dd>
- <dd><code>filename2</code> - the second filename to query, may be null</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>true if the filenames are equal, null equals null</dd>
- <dt><span class="seeLabel">See Also:</span></dt>
- <dd><a href="../../../../org/apache/commons/io/IOCase.html#SYSTEM"><code>IOCase.SYSTEM</code></a></dd>
- </dl>
- </li>
- </ul>
- <a name="equalsNormalized-java.lang.String-java.lang.String-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>equalsNormalized</h4>
- <pre>public static boolean equalsNormalized(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename1,
- <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename2)</pre>
- <div class="block">Checks whether two filenames are equal after both have been normalized.
- <p>
- Both filenames are first passed to <a href="../../../../org/apache/commons/io/FilenameUtils.html#normalize-java.lang.String-"><code>normalize(String)</code></a>.
- The check is then performed in a case-sensitive manner.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>filename1</code> - the first filename to query, may be null</dd>
- <dd><code>filename2</code> - the second filename to query, may be null</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>true if the filenames are equal, null equals null</dd>
- <dt><span class="seeLabel">See Also:</span></dt>
- <dd><a href="../../../../org/apache/commons/io/IOCase.html#SENSITIVE"><code>IOCase.SENSITIVE</code></a></dd>
- </dl>
- </li>
- </ul>
- <a name="equalsNormalizedOnSystem-java.lang.String-java.lang.String-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>equalsNormalizedOnSystem</h4>
- <pre>public static boolean equalsNormalizedOnSystem(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename1,
- <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename2)</pre>
- <div class="block">Checks whether two filenames are equal after both have been normalized
- and using the case rules of the system.
- <p>
- Both filenames are first passed to <a href="../../../../org/apache/commons/io/FilenameUtils.html#normalize-java.lang.String-"><code>normalize(String)</code></a>.
- The check is then performed case-sensitive on Unix and
- case-insensitive on Windows.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>filename1</code> - the first filename to query, may be null</dd>
- <dd><code>filename2</code> - the second filename to query, may be null</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>true if the filenames are equal, null equals null</dd>
- <dt><span class="seeLabel">See Also:</span></dt>
- <dd><a href="../../../../org/apache/commons/io/IOCase.html#SYSTEM"><code>IOCase.SYSTEM</code></a></dd>
- </dl>
- </li>
- </ul>
- <a name="equals-java.lang.String-java.lang.String-boolean-org.apache.commons.io.IOCase-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>equals</h4>
- <pre>public static boolean equals(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename1,
- <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename2,
- boolean normalized,
- <a href="../../../../org/apache/commons/io/IOCase.html" title="enum in org.apache.commons.io">IOCase</a> caseSensitivity)</pre>
- <div class="block">Checks whether two filenames are equal, optionally normalizing and providing
- control over the case-sensitivity.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>filename1</code> - the first filename to query, may be null</dd>
- <dd><code>filename2</code> - the second filename to query, may be null</dd>
- <dd><code>normalized</code> - whether to normalize the filenames</dd>
- <dd><code>caseSensitivity</code> - what case sensitivity rule to use, null means case-sensitive</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>true if the filenames are equal, null equals null</dd>
- <dt><span class="simpleTagLabel">Since:</span></dt>
- <dd>1.3</dd>
- </dl>
- </li>
- </ul>
- <a name="isExtension-java.lang.String-java.lang.String-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>isExtension</h4>
- <pre>public static boolean isExtension(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename,
- <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> extension)</pre>
- <div class="block">Checks whether the extension of the filename is that specified.
- <p>
- This method obtains the extension as the textual part of the filename
- after the last dot. There must be no directory separator after the dot.
- The extension check is case-sensitive on all platforms.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>filename</code> - the filename to query, null returns false</dd>
- <dd><code>extension</code> - the extension to check for, null or empty checks for no extension</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>true if the filename has the specified extension</dd>
- <dt><span class="throwsLabel">Throws:</span></dt>
- <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the supplied filename contains null bytes</dd>
- </dl>
- </li>
- </ul>
- <a name="isExtension-java.lang.String-java.lang.String:A-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>isExtension</h4>
- <pre>public static boolean isExtension(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename,
- <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[] extensions)</pre>
- <div class="block">Checks whether the extension of the filename is one of those specified.
- <p>
- This method obtains the extension as the textual part of the filename
- after the last dot. There must be no directory separator after the dot.
- The extension check is case-sensitive on all platforms.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>filename</code> - the filename to query, null returns false</dd>
- <dd><code>extensions</code> - the extensions to check for, null checks for no extension</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>true if the filename is one of the extensions</dd>
- <dt><span class="throwsLabel">Throws:</span></dt>
- <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the supplied filename contains null bytes</dd>
- </dl>
- </li>
- </ul>
- <a name="isExtension-java.lang.String-java.util.Collection-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>isExtension</h4>
- <pre>public static boolean isExtension(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename,
- <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>> extensions)</pre>
- <div class="block">Checks whether the extension of the filename is one of those specified.
- <p>
- This method obtains the extension as the textual part of the filename
- after the last dot. There must be no directory separator after the dot.
- The extension check is case-sensitive on all platforms.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>filename</code> - the filename to query, null returns false</dd>
- <dd><code>extensions</code> - the extensions to check for, null checks for no extension</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>true if the filename is one of the extensions</dd>
- <dt><span class="throwsLabel">Throws:</span></dt>
- <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the supplied filename contains null bytes</dd>
- </dl>
- </li>
- </ul>
- <a name="wildcardMatch-java.lang.String-java.lang.String-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>wildcardMatch</h4>
- <pre>public static boolean wildcardMatch(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename,
- <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> wildcardMatcher)</pre>
- <div class="block">Checks a filename to see if it matches the specified wildcard matcher,
- always testing case-sensitive.
- <p>
- The wildcard matcher uses the characters '?' and '*' to represent a
- single or multiple (zero or more) wildcard characters.
- This is the same as often found on Dos/Unix command lines.
- The check is case-sensitive always.
- <pre>
- wildcardMatch("c.txt", "*.txt") --> true
- wildcardMatch("c.txt", "*.jpg") --> false
- wildcardMatch("a/b/c.txt", "a/b/*") --> true
- wildcardMatch("c.txt", "*.???") --> true
- wildcardMatch("c.txt", "*.????") --> false
- </pre>
- N.B. the sequence "*?" does not work properly at present in match strings.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>filename</code> - the filename to match on</dd>
- <dd><code>wildcardMatcher</code> - the wildcard string to match against</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>true if the filename matches the wildcard string</dd>
- <dt><span class="seeLabel">See Also:</span></dt>
- <dd><a href="../../../../org/apache/commons/io/IOCase.html#SENSITIVE"><code>IOCase.SENSITIVE</code></a></dd>
- </dl>
- </li>
- </ul>
- <a name="wildcardMatchOnSystem-java.lang.String-java.lang.String-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>wildcardMatchOnSystem</h4>
- <pre>public static boolean wildcardMatchOnSystem(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename,
- <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> wildcardMatcher)</pre>
- <div class="block">Checks a filename to see if it matches the specified wildcard matcher
- using the case rules of the system.
- <p>
- The wildcard matcher uses the characters '?' and '*' to represent a
- single or multiple (zero or more) wildcard characters.
- This is the same as often found on Dos/Unix command lines.
- The check is case-sensitive on Unix and case-insensitive on Windows.
- <pre>
- wildcardMatch("c.txt", "*.txt") --> true
- wildcardMatch("c.txt", "*.jpg") --> false
- wildcardMatch("a/b/c.txt", "a/b/*") --> true
- wildcardMatch("c.txt", "*.???") --> true
- wildcardMatch("c.txt", "*.????") --> false
- </pre>
- N.B. the sequence "*?" does not work properly at present in match strings.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>filename</code> - the filename to match on</dd>
- <dd><code>wildcardMatcher</code> - the wildcard string to match against</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>true if the filename matches the wildcard string</dd>
- <dt><span class="seeLabel">See Also:</span></dt>
- <dd><a href="../../../../org/apache/commons/io/IOCase.html#SYSTEM"><code>IOCase.SYSTEM</code></a></dd>
- </dl>
- </li>
- </ul>
- <a name="wildcardMatch-java.lang.String-java.lang.String-org.apache.commons.io.IOCase-">
- <!-- -->
- </a>
- <ul class="blockListLast">
- <li class="blockList">
- <h4>wildcardMatch</h4>
- <pre>public static boolean wildcardMatch(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> filename,
- <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> wildcardMatcher,
- <a href="../../../../org/apache/commons/io/IOCase.html" title="enum in org.apache.commons.io">IOCase</a> caseSensitivity)</pre>
- <div class="block">Checks a filename to see if it matches the specified wildcard matcher
- allowing control over case-sensitivity.
- <p>
- The wildcard matcher uses the characters '?' and '*' to represent a
- single or multiple (zero or more) wildcard characters.
- N.B. the sequence "*?" does not work properly at present in match strings.</div>
- <dl>
- <dt><span class="paramLabel">Parameters:</span></dt>
- <dd><code>filename</code> - the filename to match on</dd>
- <dd><code>wildcardMatcher</code> - the wildcard string to match against</dd>
- <dd><code>caseSensitivity</code> - what case sensitivity rule to use, null means case-sensitive</dd>
- <dt><span class="returnLabel">Returns:</span></dt>
- <dd>true if the filename matches the wildcard string</dd>
- <dt><span class="simpleTagLabel">Since:</span></dt>
- <dd>1.3</dd>
- </dl>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- </div>
- </div>
- <!-- ========= END OF CLASS DATA ========= -->
- <!-- ======= START OF BOTTOM NAVBAR ====== -->
- <div class="bottomNav"><a name="navbar.bottom">
- <!-- -->
- </a>
- <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
- <a name="navbar.bottom.firstrow">
- <!-- -->
- </a>
- <ul class="navList" title="Navigation">
- <li><a href="../../../../overview-summary.html">Overview</a></li>
- <li><a href="package-summary.html">Package</a></li>
- <li class="navBarCell1Rev">Class</li>
- <li><a href="class-use/FilenameUtils.html">Use</a></li>
- <li><a href="package-tree.html">Tree</a></li>
- <li><a href="../../../../deprecated-list.html">Deprecated</a></li>
- <li><a href="../../../../index-all.html">Index</a></li>
- <li><a href="../../../../help-doc.html">Help</a></li>
- </ul>
- </div>
- <div class="subNav">
- <ul class="navList">
- <li><a href="../../../../org/apache/commons/io/FileExistsException.html" title="class in org.apache.commons.io"><span class="typeNameLink">Prev Class</span></a></li>
- <li><a href="../../../../org/apache/commons/io/FileSystemUtils.html" title="class in org.apache.commons.io"><span class="typeNameLink">Next Class</span></a></li>
- </ul>
- <ul class="navList">
- <li><a href="../../../../index.html?org/apache/commons/io/FilenameUtils.html" target="_top">Frames</a></li>
- <li><a href="FilenameUtils.html" target="_top">No Frames</a></li>
- </ul>
- <ul class="navList" id="allclasses_navbar_bottom">
- <li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
- </ul>
- <div>
- <script type="text/javascript"><!--
- allClassesLink = document.getElementById("allclasses_navbar_bottom");
- if(window==top) {
- allClassesLink.style.display = "block";
- }
- else {
- allClassesLink.style.display = "none";
- }
- //-->
- </script>
- </div>
- <div>
- <ul class="subNavList">
- <li>Summary: </li>
- <li>Nested | </li>
- <li><a href="#field.summary">Field</a> | </li>
- <li><a href="#constructor.summary">Constr</a> | </li>
- <li><a href="#method.summary">Method</a></li>
- </ul>
- <ul class="subNavList">
- <li>Detail: </li>
- <li><a href="#field.detail">Field</a> | </li>
- <li><a href="#constructor.detail">Constr</a> | </li>
- <li><a href="#method.detail">Method</a></li>
- </ul>
- </div>
- <a name="skip.navbar.bottom">
- <!-- -->
- </a></div>
- <!-- ======== END OF BOTTOM NAVBAR ======= -->
- <p class="legalCopy"><small>Copyright © 2002–2017 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
- </body>
- </html>
|