import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.OutputStream;
import java.security.DigestOutputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.logging.Logger;
import net.pterodactylus.util.io.Closer;
+import net.pterodactylus.util.io.NullOutputStream;
+import net.pterodactylus.util.io.StreamCopier;
import de.todesbaum.jsite.application.Project;
import de.todesbaum.jsite.i18n.I18n;
-import de.todesbaum.util.io.StreamCopier;
/**
* Scans the local path of a project anychronously and returns the list of found
*
* @see FileScannerListener#fileScannerFinished(FileScanner)
*/
+ @Override
public void run() {
files = new ArrayList<ScannedFile>();
error = false;
private void scanFiles(File rootDir, List<ScannedFile> fileList) throws IOException {
File[] files = rootDir.listFiles(new FileFilter() {
+ @Override
@SuppressWarnings("synthetic-access")
public boolean accept(File file) {
return !project.isIgnoreHiddenFiles() || !file.isHidden();
* The name of the file, relative to the project path
* @return The hash of the file
*/
- @SuppressWarnings("synthetic-access")
private static String hashFile(String path, String filename) {
InputStream fileInputStream = null;
DigestOutputStream digestOutputStream = null;
}
/**
- * {@link OutputStream} that discards all written bytes.
- *
- * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
- */
- private static class NullOutputStream extends OutputStream {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void write(int b) {
- /* do nothing. */
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void write(byte[] b) {
- /* do nothing. */
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void write(byte[] b, int off, int len) {
- /* do nothing. */
- }
-
- }
-
- /**
* Container for a scanned file, consisting of the name of the file and its
* hash.
*
/**
* {@inheritDoc}
*/
+ @Override
public int compareTo(ScannedFile scannedFile) {
return filename.compareTo(scannedFile.filename);
}