当前位置: 首页>>代码示例>>Java>>正文


Java FileType.IMAGINARY属性代码示例

本文整理汇总了Java中org.apache.commons.vfs.FileType.IMAGINARY属性的典型用法代码示例。如果您正苦于以下问题:Java FileType.IMAGINARY属性的具体用法?Java FileType.IMAGINARY怎么用?Java FileType.IMAGINARY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.commons.vfs.FileType的用法示例。


在下文中一共展示了FileType.IMAGINARY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getFileType

public FileType getFileType(String filename) throws KettleJobException
 {
try {
	SftpATTRS attrs=c.stat(filename);
		if (attrs == null)	return FileType.IMAGINARY;
		
		if ((attrs.getFlags() & SftpATTRS.SSH_FILEXFER_ATTR_PERMISSIONS) == 0)
			throw new KettleJobException("Unknown permissions error");

		if (attrs.isDir())
			return FileType.FOLDER;
		else
			return FileType.FILE;
} catch (Exception e) {
		throw new KettleJobException(e);
	}
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:17,代码来源:SFTPClient.java

示例2: doGetType

/**
    * Determines the type of the file, returns null if the file does not
    * exist.
    */
   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:pentaho,项目名称:pdi-vfs,代码行数:19,代码来源:MimeFileObject.java

示例3: doGetType

/**
 * Returns the file's type.
 */
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:pentaho,项目名称:pdi-vfs,代码行数:26,代码来源:LocalFile.java

示例4: 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.
 */
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:pentaho,项目名称:pdi-vfs,代码行数:27,代码来源:HttpFileObject.java

示例5: doGetType

/**
 * Determines the type of the file, returns null if the file does not
 * exist.
 */
protected FileType doGetType() throws FileSystemException
{
    if (file != null)
    {
        return file.getType();
    }
    else if (children.size() > 0)
    {
        return FileType.FOLDER;
    }
    else
    {
        return FileType.IMAGINARY;
    }
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:19,代码来源:DelegateFileObject.java

示例6: doGetType

@Override
protected FileType doGetType() throws Exception {
    synchronized (proactiveFS) {
        if (fileInfo.getType() == null) {
            return FileType.IMAGINARY;
        }

        switch (fileInfo.getType()) {
            case FILE:
                return FileType.FILE;
            case DIRECTORY:
                return FileType.FOLDER;
            default:
                throw new RuntimeException("Unexpected file type");
        }
    }
}
 
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:17,代码来源:ProActiveFileObject.java

示例7: 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:pentaho,项目名称:pdi-vfs,代码行数:35,代码来源:MimeFileObject.java

示例8: ZipFileObject

protected ZipFileObject(FileName name,
                        ZipEntry entry,
                        ZipFileSystem fs,
                        boolean zipExists) throws FileSystemException
{
    super(name, fs);
    this.fs = fs;
    setZipEntry(entry);
    if (!zipExists)
    {
        type = FileType.IMAGINARY;
    }
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:13,代码来源:ZipFileObject.java

示例9: clear

/**
 *
 */
void clear()
{
    this.buffer = new byte[0];
    updateLastModified();
    this.type = FileType.IMAGINARY;
    this.children = Collections.synchronizedCollection(new ArrayList());
    this.name = null;
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:11,代码来源:RamFileData.java

示例10: doGetType

/**
 * Determines the type of the file, returns null if the file does not
 * exist.
 */
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:pentaho,项目名称:pdi-vfs,代码行数:35,代码来源:FtpFileObject.java

示例11: TarFileObject

protected TarFileObject(FileName name,
                        TarEntry entry,
                        TarFileSystem fs,
                        boolean tarExists) throws FileSystemException
{
    super(name, fs);
    this.fs = fs;
    setTarEntry(entry);
    if (!tarExists)
    {
        type = FileType.IMAGINARY;
    }
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:13,代码来源:TarFileObject.java

示例12: doGetType

/**
 * Determines the type of the file.
 */
protected FileType doGetType() throws Exception
{
    try
    {
        // Attempt to connect & check status
        final URLConnection conn = url.openConnection();
        final InputStream in = conn.getInputStream();
        try
        {
            if (conn instanceof HttpURLConnection)
            {
                final int status = ((HttpURLConnection) conn).getResponseCode();
                // 200 is good, maybe add more later...
                if (HttpURLConnection.HTTP_OK != status)
                {
                    return FileType.IMAGINARY;
                }
            }

            return FileType.FILE;
        }
        finally
        {
            in.close();
        }
    }
    catch (final FileNotFoundException e)
    {
        return FileType.IMAGINARY;
    }
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:34,代码来源:UrlFileObject.java

示例13: maybeTypeChanged

/**
 * Checks whether the file's type has changed, and fires the appropriate
 * events.
 * @param oldType The old FileType.
 * @throws Exception if an error occurs.
 */
private void maybeTypeChanged(final FileType oldType) throws Exception
{
    final FileType newType = doGetType();
    if (oldType == FileType.IMAGINARY && newType != FileType.IMAGINARY)
    {
        handleCreate(newType);
    }
    else if (oldType != FileType.IMAGINARY && newType == FileType.IMAGINARY)
    {
        handleDelete();
    }
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:18,代码来源:DelegateFileObject.java

示例14: endOutput

/**
 * Called when the ouput stream for this file is closed.
 */
protected void endOutput() throws Exception
{
    if (getType() == FileType.IMAGINARY)
    {
        // File was created
        handleCreate(FileType.FILE);
    }
    else
    {
        // File has changed
        onChange();
    }
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:16,代码来源:AbstractFileObject.java

示例15: setFileType

private void setFileType(FileType type)
{
    if (type != null && type != FileType.IMAGINARY)
    {
        try
        {
            name.setType(type);
        }
        catch (FileSystemException e)
        {
            throw new RuntimeException(e.getMessage());
        }
    }
    this.type = type;
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:15,代码来源:AbstractFileObject.java


注:本文中的org.apache.commons.vfs.FileType.IMAGINARY属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。