@Override public boolean isThisType(String name) { // if necessary, open the file for further analysis // but check isThisType(name, false) first, for efficiency return isThisType(name, false) || isThisType(name, true); }
@Override public boolean isThisType(String name) { // if necessary, open the file for further analysis // but check isThisType(name, false) first, for efficiency return isThisType(name, false) || isThisType(name, true); }
@Override public boolean checkHeader(final byte[] block) { return getCachedImageReader(this).isThisType(block); }
@Override public boolean isFormat(final String name) { if (!realSource(name)) return false; return getCachedImageReader(this).isThisType(name); }
public static void time(String id) throws IOException, FormatException { System.out.print("Timing " + new File(id).getName() + ": "); long t1 = System.currentTimeMillis(); boolean result = reader.isThisType(id); long t2 = System.currentTimeMillis(); System.out.print((t2 - t1) + " ms to check type (" + result + "); "); long t3 = System.currentTimeMillis(); reader.setId(id); long t4 = System.currentTimeMillis(); System.out.println((t4 - t3) + " ms to initialize"); reader.close(); }
@Override public boolean isFormat(final String name, final SCIFIOConfig config) { if (!new File(name).exists() || !realSource(name)) return false; return getCachedImageReader(this).isThisType(name, config.checkerIsOpen()); }
@Override public boolean isFormat(final RandomAccessInputStream stream) throws IOException { if (!realSource(stream)) return false; return getCachedImageReader(this).isThisType( new RandomAccessInputStreamWrapper(stream)); }
@Test public void testAccuracy() { boolean openReaderIsValid = openReader.isThisType(TEST_FILE); boolean noOpenReaderIsValid = noOpenReader.isThisType(TEST_FILE); assertEquals(openReaderIsValid, noOpenReaderIsValid); assertEquals(openReaderIsValid, false); }
@Test public void testTypeCheckingSpeed() { long t0 = System.currentTimeMillis(); openReader.isThisType(TEST_FILE); long t1 = System.currentTimeMillis(); noOpenReader.isThisType(TEST_FILE); long t2 = System.currentTimeMillis(); assertTrue((t1 - t0) < TIMEOUT); assertTrue((t2 - t1) < TIMEOUT); }
if (typeTester.isThisType(subsList.get(i))) { LOGGER.debug("\tOK"); files.add(file.getAbsolutePath());