コード例 #1
0
 /**
  * Set up.
  *
  * @throws Exception
  */
 @BeforeClass
 public static void setUpClass() throws Exception {
   URL sigFileV67Url = new URL(SIGNATURE_FILE_V67_URL);
   InputStream sigFileStream = sigFileV67Url.openStream();
   File tmpSigFile = File.createTempFile("tmpsigfile", ".xml");
   FileOutputStream fos = new FileOutputStream(tmpSigFile);
   IOUtils.copy(sigFileStream, fos);
   fos.close();
   dihj = DroidIdentification.getInstance(tmpSigFile.getAbsolutePath());
 }
コード例 #2
0
 /**
  * Test ODT file format identification
  *
  * @throws IOException
  */
 @Test
 public void testIdentifyOdt() throws IOException {
   InputStream odtTestFileStream =
       DroidIdentificationTest.class.getResourceAsStream("testfile.odt");
   File tmpOdtTestFile = File.createTempFile("odttestfile", ".odt");
   FileOutputStream fos = new FileOutputStream(tmpOdtTestFile);
   IOUtils.copy(odtTestFileStream, fos);
   fos.close();
   String result = dihj.identify(tmpOdtTestFile.getAbsolutePath());
   if (result.isEmpty()) {
     fail("No identification result");
   }
   assertEquals("fmt/291", result);
 }