Skip to content

Commit

Permalink
Reinstate the use of SeekableByteChannel. Patch in Ruboto instead.
Browse files Browse the repository at this point in the history
UweKubosch committed May 10, 2017
1 parent 9629da0 commit 2834c3c
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions core/src/main/java/org/jruby/util/io/ChannelFD.java
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.SeekableByteChannel;
import java.nio.channels.SelectableChannel;
import java.nio.channels.SocketChannel;
import java.nio.channels.WritableByteChannel;
@@ -130,7 +131,7 @@ private void initChannelTypes() {
else chRead = null;
if (ch instanceof WritableByteChannel) chWrite = (WritableByteChannel)ch;
else chWrite = null;
if (ch instanceof FileChannel) chSeek = (FileChannel)ch;
if (ch instanceof SeekableByteChannel) chSeek = (SeekableByteChannel)ch;
else chSeek = null;
if (ch instanceof SelectableChannel) chSelect = (SelectableChannel)ch;
else chSelect = null;
@@ -154,7 +155,7 @@ private void initChannelTypes() {
public Channel ch;
public ReadableByteChannel chRead;
public WritableByteChannel chWrite;
public FileChannel chSeek;
public SeekableByteChannel chSeek;
public SelectableChannel chSelect;
public FileChannel chFile;
public SocketChannel chSock;
@@ -163,7 +164,7 @@ private void initChannelTypes() {
public int fakeFileno;
private AtomicInteger refs;
public FileLock currentLock;
private POSIX posix;
private final POSIX posix;
public boolean isNativeFile = false;
private final FilenoUtil filenoUtil;
}
3 changes: 2 additions & 1 deletion core/src/main/java/org/jruby/util/io/OpenFile.java
Original file line number Diff line number Diff line change
@@ -33,6 +33,7 @@
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.SeekableByteChannel;
import java.nio.channels.SelectableChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
@@ -2270,7 +2271,7 @@ public WritableByteChannel writeChannel() {
return fd.chWrite;
}

public FileChannel seekChannel() {
public SeekableByteChannel seekChannel() {
assert(fd != null);
return fd.chSeek;
}

0 comments on commit 2834c3c

Please sign in to comment.