home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
VCAFE.3.0A
/
Main.bin
/
AbstractDirectory.java
< prev
next >
Wrap
Text File
|
1998-09-24
|
4KB
|
187 lines
package com.symantec.itools.io;
import java.io.File;
import java.io.FilenameFilter;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.FileInputStream;
import java.io.FileOutputStream;
/**
* @author Symantec Internet Tools Division
* @version 1.0
* @since VCafe 3.0
*/
public class AbstractDirectory
extends Directory
{
public AbstractDirectory()
{
}
public AbstractDirectory(String dirName)
throws NotDirectoryException,
IOException
{
this(dirName, false);
}
public AbstractDirectory(String dirName, boolean create)
throws NotDirectoryException,
IOException
{
setName(dirName, create);
}
/**
* @param dirName TODO
* @param create TODO
* @exception com.symantec.itools.io.NotDirectoryException
* @exception java.io.FileNotFoundException
* @exception java.io.IOException
* @since VCafe 3.0
*/
protected void setName(String dirName, boolean create)
throws NotDirectoryException,
FileNotFoundException,
IOException
{
name = FileSystem.getCanonicalPath(dirName, true);
directory = new File(name);
if(directory.exists())
{
if(!(directory.isDirectory()))
{
throw new NotDirectoryException(name);
}
}
else
{
if(create)
{
directory.mkdirs();
}
}
}
/**
* @param filter TODO
* @param recurse TODO
* @since VCafe 3.0
*/
public String[] listFiles(FileFilenameFilter filter, boolean recurse)
{
if(!exists())
{
return (new String[0]);
}
return (super.list(filter, recurse));
}
/**
* @param filter TODO
* @param recurse TODO
* @since VCafe 3.0
*/
public String[] listDirectories(DirectoryFilenameFilter filter, boolean recurse)
{
if(!exists())
{
return (new String[0]);
}
return (super.listDirectories(filter, recurse));
}
/**
* @param filter TODO
* @param recurse TODO
* @since VCafe 3.0
*/
public String[] list(FilenameFilter filter, boolean recurse)
{
if(!exists())
{
return (new String[0]);
}
return (super.list(filter, recurse));
}
/**
* @param filter TODO
* @param dst TODO
* @param recurse TODO
* @since VCafe 3.0
*/
public boolean copyTo(FileFilenameFilter filter, Directory dst, boolean recurse)
throws IOException
{
if(!exists())
{
return (false);
}
return (super.copyTo(filter, dst, recurse));
}
/**
* @param dst TODO
* @param recurse TODO
* @since VCafe 3.0
*/
public boolean copyTo(Directory dst, boolean recurse)
throws IOException
{
if(!exists())
{
return (false);
}
return (super.copyTo(dst, recurse));
}
/**
* @since VCafe 3.0
*/
public boolean delete()
{
if(!exists())
{
return (false);
}
return (super.delete());
}
public boolean deleteAll()
{
if(!exists())
{
return (false);
}
return (super.deleteAll());
}
/**
* @since VCafe 3.0
*/
public boolean mkdir()
{
return (directory.mkdir());
}
/**
* @since VCafe 3.0
*/
public boolean mkdirs()
{
return (directory.mkdirs());
}
}