/** * Creates an item file. * @param bundle Bundle containing the file. * @param name File name. * @param mediaType Media type. * @param data File data. * @param copy If the constructor should perform a copy of the provided data. */ public static FileData item(FileData bundle, final String name, MediaType mediaType, byte[] data, boolean copy) { checkNotNull(bundle, "File bundle"); checkArgument(bundle.isBundle(), "Not a bundle"); return new FileData(bundle.getId(), name, mediaType, bundle.isDownloadable(), FileType.ITEM, data, copy); }
private FileData getFile(FileEntity entity) throws PMSException { final String savedName = entity.getName(); return new FileData(entity.getId(), savedName, FileLoaderSupport.getMediaType(savedName), entity.isDownloadable(), entity.isBundle(), entity.getData(), false); }