public class VFSUtil {
private static final Logger log = LoggerFactory.getLogger(VFSUtil.class);
public static Resource createResource(FileObject rootDir, FileObject file, String inputEncoding) throws IOException {
MediaType mediaType = MediatypeService.determineMediaType(file.getName().getBaseName());
if(mediaType == null) {
return null;
}
String href = calculateHref(rootDir, file);
Resource result = new Resource(null, IOUtils.toByteArray(file.getContent().getInputStream()), href, mediaType);