本文整理匯總了Java中org.apache.commons.vfs2.FileType.IMAGINARY屬性的典型用法代碼示例。如果您正苦於以下問題:Java FileType.IMAGINARY屬性的具體用法?Java FileType.IMAGINARY怎麽用?Java FileType.IMAGINARY使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.apache.commons.vfs2.FileType
的用法示例。
在下文中一共展示了FileType.IMAGINARY屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doGetType
/**
* Determines the type of the file, returns null if the file does not
* exist.
*/
@Override
protected FileType doGetType() throws Exception
{
if (!file.exists())
{
return FileType.IMAGINARY;
}
else if (file.isDirectory())
{
return FileType.FOLDER;
}
else if (file.isFile())
{
return FileType.FILE;
}
throw new FileSystemException("vfs.provider.Nfs/get-type.error", getName());
}
示例2: doGetType
/**
* Determines the type of the file, returns null if the file does not exist.
*
* @return the file type
*
* @throws Exception the exception
*/
@Override
protected FileType doGetType() throws Exception {
// log.debug("relative path:" + relPath);
if (this.fileInfo == null) {
return FileType.IMAGINARY;
} else if (this.fileInfo.isDirectory()) {
return FileType.FOLDER;
} else if (this.fileInfo.isFile()) {
return FileType.FILE;
} else if (this.fileInfo.isSoftLink()) {
return FileType.FILE; // getLinkDestination().getType();
}
throw new FileSystemException("vfs.provider.gsiftp/get-type.error", getName());
}
示例3: doGetType
/**
* Determines the type of this file. Must not return null. The return
* value of this method is cached, so the implementation can be expensive.
*/
@Override
protected FileType doGetType() throws Exception
{
// Use the GET method to probe the file.
method = new GetMethod();
setupMethod(method);
final HttpClient client = fileSystem.getClient();
final int status = client.executeMethod(method);
method.releaseConnection();
if (status == HttpURLConnection.HTTP_OK)
{
return FileType.FILE;
}
else if (status == HttpURLConnection.HTTP_NOT_FOUND
|| status == HttpURLConnection.HTTP_GONE)
{
return FileType.IMAGINARY;
}
else
{
throw new FileSystemException("vfs.provider.http/head.error", getName());
}
}
示例4: doGetType
/**
* Determines the type of the file, returns null if the file does not
* exist.
*/
@Override
protected FileType doGetType() throws Exception
{
if (part == null)
{
return FileType.IMAGINARY;
}
if (isMultipart())
{
// we cant have children ...
return FileType.FILE_OR_FOLDER;
}
return FileType.FILE;
}
示例5: doGetType
/**
* Determines the type of the file, returns null if the file does not
* exist.
*/
@Override
protected FileType doGetType() throws Exception
{
if (!file.exists())
{
return FileType.IMAGINARY;
}
else if (file.isDirectory())
{
return FileType.FOLDER;
}
else if (file.isFile())
{
return FileType.FILE;
}
throw new FileSystemException("vfs.provider.smb/get-type.error", getName());
}
示例6: doGetType
/**
* Returns the file's type.
*/
@Override
protected FileType doGetType() throws Exception
{
// JDK BUG: 6192331
// if (!file.exists())
if (!file.exists() && file.length() < 1)
{
return FileType.IMAGINARY;
}
if (file.isDirectory())
{
return FileType.FOLDER;
}
// In doubt, treat an existing file as file
// if (file.isFile())
// {
return FileType.FILE;
// }
// throw new FileSystemException("vfs.provider.local/get-type.error", file);
}
示例7: doGetType
/**
* Determines the type of this file. Must not return null. The return
* value of this method is cached, so the implementation can be expensive.
*/
@Override
protected FileType doGetType() throws Exception
{
// Use the HEAD method to probe the file.
method = new HeadMethod();
setupMethod(method);
final HttpClient client = fileSystem.getClient();
final int status = client.executeMethod(method);
method.releaseConnection();
if (status == HttpURLConnection.HTTP_OK)
{
return FileType.FILE;
}
else if (status == HttpURLConnection.HTTP_NOT_FOUND
|| status == HttpURLConnection.HTTP_GONE)
{
return FileType.IMAGINARY;
}
else
{
throw new FileSystemException("vfs.provider.http/head.error", getName());
}
}
示例8: doGetType
/**
* Determines the type of the file, returns null if the file does not
* exist.
*/
@Override
protected FileType doGetType() throws FileSystemException
{
if (file != null)
{
return file.getType();
}
else if (children.size() > 0)
{
return FileType.FOLDER;
}
else
{
return FileType.IMAGINARY;
}
}
示例9: doGetType
/** Returns the file's type. */
@Override
protected FileType doGetType() throws Exception {
// JDK BUG: 6192331
// if (!file.exists())
if (!file.exists() && file.length() < 1) {
return FileType.IMAGINARY;
}
if (file.isDirectory()) {
return FileType.FOLDER;
}
// In doubt, treat an existing file as file
// if (file.isFile())
// {
return FileType.FILE;
// }
// throw new FileSystemException("vfs.provider.local/get-type.error", file);
}
示例10: getFileType
/**
* Determine whether file object is a file or a folder.
*
* @param fileObject File to get the type of
* @return FileType of given file
*/
private FileType getFileType(FileObject fileObject) throws RemoteFileSystemConnectorException {
try {
return fileObject.getType();
} catch (FileSystemException e) {
remoteFileSystemListener.onError(new RemoteFileSystemConnectorException(
"[" + serviceName + "] Error occurred when determining whether file: " +
FileTransportUtils.maskURLPassword(fileObject.getName().getURI()) +
" is a file or a folder", e));
}
return FileType.IMAGINARY;
}
示例11: findPart
private Part findPart(String partName) throws Exception
{
if (getType() == FileType.IMAGINARY)
{
// not existent
return null;
}
if (isMultipart())
{
Multipart multipart = (Multipart) part.getContent();
if (partName.startsWith(MimeFileSystem.NULL_BP_NAME))
{
int partNumber = Integer.parseInt(partName.substring(MimeFileSystem.NULL_BP_NAME.length()), 10);
if (partNumber < 0 || partNumber+1 > multipart.getCount())
{
// non existent
return null;
}
return multipart.getBodyPart(partNumber);
}
for (int i = 0; i<multipart.getCount(); i++)
{
Part childPart = multipart.getBodyPart(i);
if (partName.equals(childPart.getFileName()))
{
return childPart;
}
}
}
return null;
}
示例12: ZipFileObject
protected ZipFileObject(AbstractFileName name,
ZipEntry entry,
ZipFileSystem fs,
boolean zipExists) throws FileSystemException
{
super(name, fs);
this.fs = fs;
setZipEntry(entry);
if (!zipExists)
{
type = FileType.IMAGINARY;
}
}
示例13: clear
/**
*
*/
void clear()
{
this.buffer = new byte[0];
updateLastModified();
this.type = FileType.IMAGINARY;
this.children.clear();
this.name = null;
}
示例14: doGetType
/**
* Determines the type of the file, returns null if the file does not
* exist.
*/
@Override
protected FileType doGetType()
throws Exception
{
// VFS-210
synchronized (getFileSystem())
{
if (this.fileInfo == null)
{
getInfo(false);
}
if (this.fileInfo == UNKNOWN)
{
return FileType.IMAGINARY;
}
else if (this.fileInfo.isDirectory())
{
return FileType.FOLDER;
}
else if (this.fileInfo.isFile())
{
return FileType.FILE;
}
else if (this.fileInfo.isSymbolicLink())
{
return getLinkDestination().getType();
}
}
throw new FileSystemException("vfs.provider.ftp/get-type.error", getName());
}
示例15: doGetType
/**
* Determines the type of this file, returns null if the file does not
* exist.
*/
@Override
protected FileType doGetType() throws Exception
{
if (attrs == null)
{
statSelf();
}
if (attrs == null)
{
return FileType.IMAGINARY;
}
if ((attrs.getFlags() & SftpATTRS.SSH_FILEXFER_ATTR_PERMISSIONS) == 0)
{
throw new FileSystemException(
"vfs.provider.sftp/unknown-permissions.error");
}
if (attrs.isDir())
{
return FileType.FOLDER;
}
else
{
return FileType.FILE;
}
}