當前位置: 首頁>>代碼示例>>Java>>正文


Java IOUtils.contentEquals方法代碼示例

本文整理匯總了Java中org.apache.commons.io.IOUtils.contentEquals方法的典型用法代碼示例。如果您正苦於以下問題:Java IOUtils.contentEquals方法的具體用法?Java IOUtils.contentEquals怎麽用?Java IOUtils.contentEquals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.io.IOUtils的用法示例。


在下文中一共展示了IOUtils.contentEquals方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getTest

import org.apache.commons.io.IOUtils; //導入方法依賴的package包/類
@Test
public void getTest() throws IOException {
    String id;
    try (InputStream stream = resource("cz/inqool/uas/file/test.pdf")) {
        FileRef pdfFile = repository.create(stream, "test.pdf", "application/pdf", false);
        id = pdfFile.getId();
    }

    FileRef fileRef = repository.get(id);
    assertThat(fileRef, is(notNullValue()));
    assertThat(fileRef.getName(), is("test.pdf"));
    assertThat(fileRef.getContentType(), is("application/pdf"));
    assertThat(fileRef.getSize(), is(greaterThan(0L)));

    try (InputStream stream = resource("cz/inqool/uas/file/test.pdf"); InputStream stream2 = fileRef.getStream()) {
        IOUtils.contentEquals(stream, stream2);
    }
}
 
開發者ID:LIBCAS,項目名稱:ARCLib,代碼行數:19,代碼來源:FileRepositoryTest.java

示例2: resetTest

import org.apache.commons.io.IOUtils; //導入方法依賴的package包/類
@Test
public void resetTest() throws IOException {
    String id;
    try (InputStream stream = resource("cz/inqool/uas/file/test.pdf")) {
        FileRef pdfFile = repository.create(stream, "test.pdf", "application/pdf", false);
        id = pdfFile.getId();
    }

    FileRef fileRef = repository.get(id);
    try (InputStream stream = resource("cz/inqool/uas/file/test.pdf"); InputStream stream2 = fileRef.getStream()) {
        IOUtils.contentEquals(stream, stream2);
    }

    repository.reset(fileRef);
    try (InputStream stream = resource("cz/inqool/uas/file/test.pdf"); InputStream stream2 = fileRef.getStream()) {
        IOUtils.contentEquals(stream, stream2);
    }
}
 
開發者ID:LIBCAS,項目名稱:ARCLib,代碼行數:19,代碼來源:FileRepositoryTest.java

示例3: deleteMissingFileTest

import org.apache.commons.io.IOUtils; //導入方法依賴的package包/類
@Test
public void deleteMissingFileTest() throws IOException {
    String id;
    try (InputStream stream = resource("cz/inqool/uas/file/test.pdf")) {
        FileRef pdfFile = repository.create(stream, "test.pdf", "application/pdf", false);
        id = pdfFile.getId();
    }

    FileRef fileRef = repository.get(id);
    try (InputStream stream = resource("cz/inqool/uas/file/test.pdf"); InputStream stream2 = fileRef.getStream()) {
        IOUtils.contentEquals(stream, stream2);
    }

    repository.del(fileRef);
    repository.del(fileRef);

    assertThrown(() -> repository.get(id))
            .isInstanceOf(MissingObject.class);
}
 
開發者ID:LIBCAS,項目名稱:ARCLib,代碼行數:20,代碼來源:FileRepositoryTest.java

示例4: deleteTest

import org.apache.commons.io.IOUtils; //導入方法依賴的package包/類
@Test
public void deleteTest() throws IOException {
    String id;
    try (InputStream stream = resource("cz/inqool/uas/file/test.pdf")) {
        FileRef pdfFile = repository.create(stream, "test.pdf", "application/pdf", false);
        id = pdfFile.getId();
    }

    FileRef fileRef = repository.get(id);
    try (InputStream stream = resource("cz/inqool/uas/file/test.pdf"); InputStream stream2 = fileRef.getStream()) {
        IOUtils.contentEquals(stream, stream2);
    }

    repository.del(fileRef);

    assertThrown(() -> repository.get(id))
            .isInstanceOf(MissingObject.class);
}
 
開發者ID:LIBCAS,項目名稱:ARCLib,代碼行數:19,代碼來源:FileRepositoryTest.java

示例5: verifyFilesOnEqual

import org.apache.commons.io.IOUtils; //導入方法依賴的package包/類
@Override
public void verifyFilesOnEqual(String filePath, File lastDownloadedFile) throws IOException, SAXException, ParserConfigurationException {
    Reader expectedFile = new FileReader(lastDownloadedFile);
    Reader actualFile = new FileReader(filePath);
    boolean isEquals = IOUtils.contentEquals(expectedFile, actualFile);
    Assert.assertTrue("File must be equal on 100%", isEquals);
}
 
開發者ID:tapack,項目名稱:satisfy,代碼行數:8,代碼來源:PdfProvider.java


注:本文中的org.apache.commons.io.IOUtils.contentEquals方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。