if (info.content == null && info.firstTimeInput != null) {
// no cache, and we have opened it at first time
InputStream input = info.firstTimeInput;
info.firstTimeInput = null;
return new BinaryDataProvider(input);
} else if (info.content == null && info.firstTimeInput == null) {
// no cache
return new BinaryDataProvider(servletContext, this.getClass().getClassLoader(), info.path);
} else {
// should cache
byte[] data = null;
data = info.content.get();
if (data == null) {
InputStream input = BinaryDataUtil.retrieveInputStreamByPath(servletContext, this.getClass().getClassLoader(), path);
data = retrieveBytesFromInputStream(input, info.cacheLimit);
info.content = new SoftReference<byte[]>(data);
}
return new BinaryDataProvider(data);
}
}