public static String getEntryContentAsString(InputStream stream, String searchedEntryName) throws IOException { try (InputStream resultStream = getEntryContentAsStream(stream, searchedEntryName)) { return IOUtils.toString(resultStream, UTF_8); } }
public static byte[] getEntryContentAsBytes(URL url, String entryName) throws IOException { try (InputStream resultStream = getEntryContentAsStream(url, entryName)) { return IOUtils.toByteArray(resultStream); } }
public static byte[] getEntryContentAsBytes(InputStream stream, String searchedEntryName) throws IOException { try (InputStream resultStream = getEntryContentAsStream(stream, searchedEntryName)) { return IOUtils.toByteArray(resultStream); } }
public static String getEntryContentAsString(URL url, String entryName) throws IOException { try (InputStream resultStream = getEntryContentAsStream(url, entryName)) { return IOUtils.toString(resultStream, UTF_8); } }
public static InputStream getEntryContentAsStream(URL url, String entryName) throws IOException { return getEntryContentAsStream(url.openStream(), entryName); }
/** * Unzip directly the entry. * * @return the String content of the entry with name entryName * @param file the source file * @param entryName the entry name that has to be extracted * @deprecated since 10.1 (unused and fails to close a ZipFile) */ @Deprecated public static String getEntryContentAsString(File file, String entryName) throws IOException { try (InputStream resultStream = getEntryContentAsStream(file, entryName)) { return IOUtils.toString(resultStream, UTF_8); } }
/** * Unzips directly the entry. * * @return The byte array content of the entry with name entryName * @param file the source file * @param entryName the entry name that has to be extracted * @deprecated since 10.1 (unused and fails to close a ZipFile) */ @Deprecated public static byte[] getEntryContentAsBytes(File file, String entryName) throws IOException { try (InputStream resultStream = getEntryContentAsStream(file, entryName)) { return IOUtils.toByteArray(resultStream); } }
try (InputStream previewPDFFile = ZipUtils.getEntryContentAsStream(blob.getStream(), IWORK_PREVIEW_FILE)) { previewBlob = Blobs.createBlob(previewPDFFile);