Changeset 24969 for main/trunk
- Timestamp:
- 2012-01-24T15:35:00+13:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/LibraryServlet.java
r24967 r24969 22 22 import java.io.File; 23 23 import java.lang.reflect.Type; 24 import java.nio.channels.FileChannel; 24 25 import java.util.Hashtable; 25 26 import org.apache.log4j.*; … … 437 438 } 438 439 439 logger.info("Moving uploaded file (" + uploadedFile.getAbsolutePath() + ") to " + toFile.getAbsolutePath()); 440 uploadedFile.renameTo(toFile); 440 441 FileChannel source = null; 442 FileChannel destination = null; 443 try 444 { 445 logger.info("Moving uploaded file (" + uploadedFile.getAbsolutePath() + ") to " + toFile.getAbsolutePath()); 446 source = new FileInputStream(uploadedFile).getChannel(); 447 destination = new FileOutputStream(toFile).getChannel(); 448 destination.transferFrom(source, 0, source.size()); 449 } 450 finally 451 { 452 if (source != null) 453 { 454 source.close(); 455 } 456 if (destination != null) 457 { 458 destination.close(); 459 } 460 } 461 441 462 } 442 463 }
Note:
See TracChangeset
for help on using the changeset viewer.