Example usage for org.apache.commons.vfs FileTypeHasNoContentException FileTypeHasNoContentException

List of usage examples for org.apache.commons.vfs FileTypeHasNoContentException FileTypeHasNoContentException

Introduction

In this page you can find the example usage for org.apache.commons.vfs FileTypeHasNoContentException FileTypeHasNoContentException.

Prototype

public FileTypeHasNoContentException(final Object info0) 

Source Link

Usage

From source file:org.jclouds.vfs.provider.blobstore.BlobStoreFileObject.java

@Override
protected InputStream doGetInputStream() throws Exception {
    if (!getType().hasContent()) {
        throw new FileSystemException("vfs.provider/read-not-file.error", getName());
    }//from  ww  w.  j a  v  a  2s.c om
    if (metadata != null && metadata.getType() != StorageType.BLOB) {
        throw new FileTypeHasNoContentException(getName());
    }
    logger.info(String.format(">> get: %s/%s", getContainer(), getNameTrimLeadingSlashes()));
    Blob blob = getBlobStore().getBlob(getContainer(), getNameTrimLeadingSlashes());
    return blob.getPayload().getInput();
}