edtFTPj/Free - Open-source FTP library for Java | Download


com.enterprisedt.net.ftp
Class FileTypes

java.lang.Object
  extended by com.enterprisedt.net.ftp.FileTypes

public class FileTypes
extends java.lang.Object

Attempts to classify files as ASCII or binary via their filename extension. Email support at enterprisedt dot com if you feel we have missed out important file types. Of course, extensions can be registered and unregistered at runtime to customize file types for different applications

Version:
$Revision: 1.4 $
Author:
Bruce Blackshaw

Field Summary
static FileTypes ASCII
           
static FileTypes BINARY
           
 
Method Summary
 java.lang.String[] extensions()
          Get the list of registered file extensions
 boolean matches(java.io.File file)
          Determines if a file matches this extension type
 boolean matches(java.lang.String name)
          Determines if a file matches this extension type
 void registerExtension(java.lang.String ext)
          Register a new file extension
 void unregisterExtension(java.lang.String ext)
          Unregister a file extension
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ASCII

public static final FileTypes ASCII

BINARY

public static final FileTypes BINARY
Method Detail

extensions

public java.lang.String[] extensions()
Get the list of registered file extensions

Returns:
String[] of file extensions

registerExtension

public void registerExtension(java.lang.String ext)
Register a new file extension

Parameters:
ext - filename extension (excluding ".") to register

unregisterExtension

public void unregisterExtension(java.lang.String ext)
Unregister a file extension

Parameters:
ext - filename extension (excluding ".") to unregister

matches

public boolean matches(java.io.File file)
Determines if a file matches this extension type

Parameters:
file - handle to file
Returns:
true if matches, false otherwise

matches

public boolean matches(java.lang.String name)
Determines if a file matches this extension type

Parameters:
name - file's name
Returns:
true if matches, false otherwise


Copyright (c) 2001-2007 Enterprise Distributed Technologies Ltd. All Rights Reserved.