mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-13 09:18:05 -04:00
Merge branch 'master-MC1.10' into master-MC1.11
This commit is contained in:
commit
0b05ae4314
@ -2,6 +2,7 @@ package li.cil.oc.server.fs
|
||||
|
||||
import java.io
|
||||
import java.io.FileNotFoundException
|
||||
import java.nio.ByteBuffer
|
||||
import java.util.concurrent.CancellationException
|
||||
import java.util.concurrent.Future
|
||||
import java.util.concurrent.TimeUnit
|
||||
@ -131,7 +132,19 @@ trait Buffered extends OutputStreamFileSystem {
|
||||
childFile.createNewFile()
|
||||
val out = new io.FileOutputStream(childFile).getChannel
|
||||
val in = openInputChannel(childPath).get
|
||||
out.transferFrom(in, 0, Long.MaxValue)
|
||||
|
||||
val buffer = ByteBuffer.allocateDirect(16 * 1024)
|
||||
while (in.read(buffer) != -1) {
|
||||
buffer.flip()
|
||||
out.write(buffer)
|
||||
buffer.compact()
|
||||
}
|
||||
|
||||
buffer.flip()
|
||||
while (buffer.hasRemaining) {
|
||||
out.write(buffer)
|
||||
}
|
||||
|
||||
out.close()
|
||||
in.close()
|
||||
childFile.setLastModified(time)
|
||||
|
Loading…
x
Reference in New Issue
Block a user