import java.util.Set;
import org.simantics.databoard.file.RuntimeIOException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class FileIO {
-
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(FileIO.class);
private static final FileAttribute<?>[] NO_ATTRIBUTES = new FileAttribute[0];
private static final Set<OpenOption> CREATE_OPTIONS = new HashSet<>(2);
if(TRACE_PERF) {
long duration = System.nanoTime()-start;
double ds = 1e-9*duration;
- System.err.println("Wrote " + bytes.length + " bytes @ " + 1e-6*bytes.length / ds + "MB/s");
+ LOGGER.info("Wrote " + bytes.length + " bytes @ " + 1e-6*bytes.length / ds + "MB/s");
}
return result;
} catch (Throwable t) {
}
byte[] result = buf.array();
if (result.length != length)
- System.err.println("faa");
+ LOGGER.info("result length does not match expected {} {} {}", this, result.length, length);
if (TRACE_PERF) {
long duration = System.nanoTime() - start;
double ds = 1e-9 * duration;
- System.err.println("Read " + result.length + " bytes @ " + 1e-6 * result.length / ds + "MB/s");
+ LOGGER.info("Read " + result.length + " bytes @ " + 1e-6 * result.length / ds + "MB/s");
}
return result;
}
syncPath(test);
- long duration = System.nanoTime()-s;
- System.err.println("Took " + 1e-6*duration + "ms.");
-
-
+ if (LOGGER.isDebugEnabled()) {
+ long duration = System.nanoTime()-s;
+ LOGGER.info("Took " + 1e-6*duration + "ms.");
+ }
}
}