Advertisement
Guest User

Untitled

a guest
Jan 30th, 2013
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. FileOutputStream file = new FileOutputStream(_outFile);
  2. file.getChannel().lock();
  3.  
  4. for (int i=0; i<files.length; i++) {
  5. try {
  6. System.out.print((files[i]).getName());
  7. test = new FileOutputStream(files[i]);
  8. FileLock lock = test.getChannel().tryLock();
  9. if (lock != null) {
  10. lock.release();
  11. //Not a partial download. Do stuff.
  12. }
  13. } catch (Exception e) {
  14. e.printStackTrace();
  15. } finally {
  16. test.close();
  17. }
  18. }
  19.  
  20. test = new FileOutputStream(files[i], true); // the true specifies for append
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement