本文整理匯總了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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}