Java Snippet - Fast File Copy
When using JDK 1.4 and above... ```java
public static void copyFile(File in, File out) { try { FileChannel sourceChannel = new FileInputStream(in).getChannel(); FileChannel destinationChannel = new FileOutputStream(out).getChannel(); sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel); // or, you can also copy it this way // destinationChannel.transferFrom(sourceChannel, 0, sourceChannel.size()); sourceChannel.close(); destinationChannel.close(); } catch ( Exception e ) { e.printStackTrace(); } }
$ subscribe --newsletter
Practical AI engineering, in your inbox
Field notes for technical leaders building agents, evaluation systems, governance, and production infrastructure.
Related
Your Tests Passed. Which Revision Is Running?
A release receipt should connect the tested candidate, built artifact, deployment and production route without pretending one smoke check proves everything.
The Agent Timed Out. Did the Action Happen?
A decision table for retrying agent actions when the response is lost, with stable intent, provider-specific idempotency and an explicit unknown outcome.
A Desk Kraken That Keeps Track of My Claude and Codex Allowance
A Raspberry Pi Zero 2 W and a seven-colour e-ink panel turn my remaining Claude and Codex allowance into artwork: tentacle coils, speech balloons, reactor tanks and moth wings. ImageGen painted the scenes; code draws every live number.