当前位置: 首页>>代码示例>>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;未经允许,请勿转载。