當前位置: 首頁>>代碼示例>>Java>>正文


Java FileType.IMAGINARY屬性代碼示例

本文整理匯總了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());
}
 
開發者ID:danniss,項目名稱:common-vfs2-nfs,代碼行數:22,代碼來源:NfsFileObject.java

示例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());
}
 
開發者ID:clstoulouse,項目名稱:motu,代碼行數:23,代碼來源:GsiFtpFileObject.java

示例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());
    }
}
 
開發者ID:UnifiedViews,項目名稱:Plugins,代碼行數:27,代碼來源:HttpFileObject.java

示例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;
}
 
開發者ID:wso2,項目名稱:wso2-commons-vfs,代碼行數:20,代碼來源:MimeFileObject.java

示例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());
}
 
開發者ID:wso2,項目名稱:wso2-commons-vfs,代碼行數:22,代碼來源:SmbFileObject.java

示例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);
}
 
開發者ID:wso2,項目名稱:wso2-commons-vfs,代碼行數:26,代碼來源:LocalFile.java

示例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());
    }
}
 
開發者ID:wso2,項目名稱:wso2-commons-vfs,代碼行數:27,代碼來源:HttpFileObject.java

示例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;
    }
}
 
開發者ID:wso2,項目名稱:wso2-commons-vfs,代碼行數:20,代碼來源:DelegateFileObject.java

示例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);
}
 
開發者ID:AludraTest,項目名稱:aludratest,代碼行數:21,代碼來源:AludraLocalFile.java

示例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;
}
 
開發者ID:wso2,項目名稱:carbon-transports,代碼行數:18,代碼來源:RemoteFileSystemConsumer.java

示例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;
}
 
開發者ID:wso2,項目名稱:wso2-commons-vfs,代碼行數:35,代碼來源:MimeFileObject.java

示例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;
    }
}
 
開發者ID:wso2,項目名稱:wso2-commons-vfs,代碼行數:13,代碼來源:ZipFileObject.java

示例13: clear

/**
 *
 */
void clear()
{
    this.buffer = new byte[0];
    updateLastModified();
    this.type = FileType.IMAGINARY;
    this.children.clear();
    this.name = null;
}
 
開發者ID:wso2,項目名稱:wso2-commons-vfs,代碼行數:11,代碼來源:RamFileData.java

示例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());
}
 
開發者ID:wso2,項目名稱:wso2-commons-vfs,代碼行數:36,代碼來源:FtpFileObject.java

示例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;
    }
}
 
開發者ID:wso2,項目名稱:wso2-commons-vfs,代碼行數:31,代碼來源:SftpFileObject.java


注:本文中的org.apache.commons.vfs2.FileType.IMAGINARY屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。