org.fabric3.spi.scanner.AbstractResource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fabric3-contribution-scanner-spi Show documentation
Show all versions of fabric3-contribution-scanner-spi Show documentation
Fabric3 Contribution Scanner SPI.
package org.fabric3.spi.scanner;
import java.io.IOException;
import org.fabric3.spi.scanner.FileSystemResource;
/**
* Base file system resource implementation
*
* @version $Rev: 3581 $ $Date: 2008-04-07 23:04:07 -0700 (Mon, 07 Apr 2008) $
*/
public abstract class AbstractResource implements FileSystemResource {
protected byte[] checksumValue;
public boolean isChanged() throws IOException {
byte[] newValue = checksum();
if (checksumValue == null || checksumValue.length != newValue.length) {
checksumValue = newValue;
return true;
}
for (int i = 0; i < newValue.length; i++) {
if (newValue[i] != checksumValue[i]) {
checksumValue = newValue;
return true;
}
}
return false;
}
public byte[] getChecksum() {
return checksumValue;
}
public void reset() throws IOException {
checksumValue = checksum();
}
protected abstract byte[] checksum() throws IOException;
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy