Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FileOutputStream file = new FileOutputStream(_outFile);
- file.getChannel().lock();
- for (int i=0; i<files.length; i++) {
- try {
- System.out.print((files[i]).getName());
- test = new FileOutputStream(files[i]);
- FileLock lock = test.getChannel().tryLock();
- if (lock != null) {
- lock.release();
- //Not a partial download. Do stuff.
- }
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- test.close();
- }
- }
- test = new FileOutputStream(files[i], true); // the true specifies for append
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement