File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
network-common/src/main/java/org/apache/spark/network/buffer
network-shuffle/src/main/java/org/apache/spark/network/shuffle Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change 2424import java .io .RandomAccessFile ;
2525import java .nio .ByteBuffer ;
2626import java .nio .channels .FileChannel ;
27+ import java .nio .file .StandardOpenOption ;
2728
2829import com .google .common .base .Objects ;
2930import com .google .common .io .ByteStreams ;
@@ -132,7 +133,7 @@ public Object convertToNetty() throws IOException {
132133 if (conf .lazyFileDescriptor ()) {
133134 return new DefaultFileRegion (file , offset , length );
134135 } else {
135- FileChannel fileChannel = new FileInputStream (file ). getChannel ( );
136+ FileChannel fileChannel = FileChannel . open (file . toPath (), StandardOpenOption . READ );
136137 return new DefaultFileRegion (fileChannel , offset , length );
137138 }
138139 }
Original file line number Diff line number Diff line change 1919
2020import java .io .DataInputStream ;
2121import java .io .File ;
22- import java .io .FileInputStream ;
2322import java .io .IOException ;
2423import java .nio .ByteBuffer ;
2524import java .nio .LongBuffer ;
25+ import java .nio .file .Files ;
2626
2727/**
2828 * Keeps the index information for a particular map output
@@ -39,7 +39,7 @@ public ShuffleIndexInformation(File indexFile) throws IOException {
3939 offsets = buffer .asLongBuffer ();
4040 DataInputStream dis = null ;
4141 try {
42- dis = new DataInputStream (new FileInputStream (indexFile ));
42+ dis = new DataInputStream (Files . newInputStream (indexFile . toPath () ));
4343 dis .readFully (buffer .array ());
4444 } finally {
4545 if (dis != null ) {
You can’t perform that action at this time.
0 commit comments