litesoft
@ 821
litesoft / trunk / Java / core / Server / src / org / litesoft / textfiledirectory / AbstractTextFileDirectory.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
package org.litesoft.textfiledirectory; import org.litesoft.core.typeutils.*; public abstract class AbstractTextFileDirectory implements TextFileDirectory { protected String[] preprocessExtensions( String[] pExtensions ) { String[] zExtensions = Objects.deNull( pExtensions, Strings.EMPTY_ARRAY ); for ( int i = 0; i < zExtensions.length; i++ ) { zExtensions[i] = "." + Strings.assertNotNullNotEmpty( "Extension[" + i + "]", zExtensions[i] ); } return zExtensions; } protected void assertExists( boolean pExists, String pFileName ) { if ( !pExists ) { throw new FileDoesNotExists( "No File or Not a File: " + getDirectoryPath() + "/" + pFileName ); } } protected void assertNotExists( boolean pExists, String pFileName ) { if ( pExists ) { throw new FileAlreadExists( "Already an existing File: " + getDirectoryPath() + "/" + pFileName ); } } } |