Package org.apache.commons.compress.archivers.zip

Examples of org.apache.commons.compress.archivers.zip.ZipArchiveInputStream$Buffer


  public void testDocWAVText() throws Exception {
    Response response = WebClient.create(endPoint + ALL_PATH)
        .type(APPLICATION_MSWORD).accept("application/zip")
        .put(ClassLoader.getSystemResourceAsStream(TEST_DOC_WAV));

    ArchiveInputStream zip = new ZipArchiveInputStream(
        (InputStream) response.getEntity());

    Map<String, String> data = readArchive(zip);
    assertEquals(WAV1_MD5, data.get(WAV1_NAME));
    assertEquals(WAV2_MD5, data.get(WAV2_NAME));
View Full Code Here


  public void testDocPicture() throws Exception {
    Response response = WebClient.create(endPoint + UNPACKER_PATH)
        .type(APPLICATION_MSWORD).accept("application/zip")
        .put(ClassLoader.getSystemResourceAsStream(TEST_DOC_WAV));

    ZipArchiveInputStream zip = new ZipArchiveInputStream(
        (InputStream) response.getEntity());
    Map<String, String> data = readArchive(zip);

    assertEquals(JPG_MD5, data.get(JPG_NAME));
  }
View Full Code Here

  public void testDocPictureNoOle() throws Exception {
    Response response = WebClient.create(endPoint + UNPACKER_PATH)
        .type(APPLICATION_MSWORD).accept("application/zip")
        .put(ClassLoader.getSystemResourceAsStream("2pic.doc"));

    ZipArchiveInputStream zip = new ZipArchiveInputStream(
        (InputStream) response.getEntity());

    Map<String, String> data = readArchive(zip);
    assertEquals(JPG2_MD5, data.get(JPG2_NAME));
  }
View Full Code Here

  public void testImageDOCX() throws Exception {
    Response response = WebClient.create(endPoint + UNPACKER_PATH)
    .accept("application/zip").put(
        ClassLoader.getSystemResourceAsStream(TEST_DOCX_IMAGE));

    ZipArchiveInputStream zip = new ZipArchiveInputStream(
        (InputStream) response.getEntity());

    Map<String, String> data = readArchive(zip);
    assertEquals(DOCX_IMAGE1_MD5, data.get(DOCX_IMAGE1_NAME));
    assertEquals(DOCX_IMAGE2_MD5, data.get(DOCX_IMAGE2_NAME));
View Full Code Here

    String TEST_DOCX_EXE = "2exe.docx";
    Response response = WebClient.create(endPoint + UNPACKER_PATH)
        .accept("application/zip")
        .put(ClassLoader.getSystemResourceAsStream(TEST_DOCX_EXE));

    ZipArchiveInputStream zip = new ZipArchiveInputStream(
        (InputStream) response.getEntity());

    Map<String, String> data = readArchive(zip);

    assertEquals(DOCX_EXE1_MD5, data.get(DOCX_EXE1_NAME));
View Full Code Here

  public void testImageXSL() throws Exception {
    Response response = WebClient.create(endPoint + UNPACKER_PATH)
        .accept("application/zip")
        .put(ClassLoader.getSystemResourceAsStream("pic.xls"));

    ZipArchiveInputStream zip = new ZipArchiveInputStream(
        (InputStream) response.getEntity());

    Map<String, String> data = readArchive(zip);
    assertEquals(XSL_IMAGE1_MD5, data.get("0.jpg"));
    assertEquals(XSL_IMAGE2_MD5, data.get("1.jpg"));
View Full Code Here

    Response response = WebClient.create(endPoint + ALL_PATH)
        .header(CONTENT_TYPE, APPLICATION_XML)
        .accept("application/zip")
        .put(ClassLoader.getSystemResourceAsStream("test.doc"));

    String responseMsg = readArchiveText(new ZipArchiveInputStream(
        (InputStream) response.getEntity()));
    assertNotNull(responseMsg);
    assertTrue(responseMsg.contains("test"));
  }
View Full Code Here

        if (AR.equalsIgnoreCase(archiverName)) {
            return new ArArchiveInputStream(in);
        }
        if (ZIP.equalsIgnoreCase(archiverName)) {
            return new ZipArchiveInputStream(in);
        }
        if (TAR.equalsIgnoreCase(archiverName)) {
            return new TarArchiveInputStream(in);
        }
        if (JAR.equalsIgnoreCase(archiverName)) {
View Full Code Here

        in.mark(signature.length);
        try {
            int signatureLength = in.read(signature);
            in.reset();
            if (ZipArchiveInputStream.matches(signature, signatureLength)) {
                return new ZipArchiveInputStream(in);
            } else if (JarArchiveInputStream.matches(signature, signatureLength)) {
                return new JarArchiveInputStream(in);
            } else if (ArArchiveInputStream.matches(signature, signatureLength)) {
                return new ArArchiveInputStream(in);
            } else if (CpioArchiveInputStream.matches(signature, signatureLength)) {
View Full Code Here

        extract(new TarArchiveInputStream(new FileInputStream(uncompressedFile)), targetFolder);
        FileUtils.forceDelete(uncompressedFile);
    }

    private void extractZipDistribution(URL sourceDistribution, File targetFolder) throws IOException {
        extract(new ZipArchiveInputStream(sourceDistribution.openStream()), targetFolder);
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.compress.archivers.zip.ZipArchiveInputStream$Buffer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.