Example usage for org.apache.commons.fileupload LiferayFileItem getSize

List of usage examples for org.apache.commons.fileupload LiferayFileItem getSize

Introduction

In this page you can find the example usage for org.apache.commons.fileupload LiferayFileItem getSize.

Prototype

public long getSize() 

Source Link

Document

Returns the size of the file.

Usage

From source file:com.liferay.portal.upload.UploadServletRequestImpl.java

public Long getSize(String name) {
    LiferayFileItem[] liferayFileItems = _params.get(name);

    if ((liferayFileItems != null) && (liferayFileItems.length > 0)) {
        LiferayFileItem liferayFileItem = liferayFileItems[0];

        return new Long(liferayFileItem.getSize());
    } else {//from   w  w w . j  av a2  s. c om
        return null;
    }
}

From source file:com.liferay.portal.upload.UploadServletRequestImpl.java

protected InputStream getInputStream(LiferayFileItem liferayFileItem, boolean deleteOnClose)
        throws IOException {

    InputStream inputStream = null;

    if (liferayFileItem.isInMemory() && (liferayFileItem.getSize() > 0)) {
        inputStream = liferayFileItem.getInputStream();
    } else if (!liferayFileItem.isInMemory()) {
        inputStream = new ByteArrayFileInputStream(liferayFileItem.getStoreLocation(),
                liferayFileItem.getSizeThreshold(), deleteOnClose);
    }//from w  w  w . jav  a2 s . co  m

    return inputStream;
}