Skip to content

Commit

Permalink
* Ise FileChannel instead of SeekableByteChannel to enable running on…
Browse files Browse the repository at this point in the history
… Ruboto
  • Loading branch information
donv committed Aug 7, 2014
1 parent 0634898 commit e712294
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions core/src/main/java/org/jruby/util/io/ChannelFD.java
Expand Up @@ -13,7 +13,6 @@
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;
Expand Down Expand Up @@ -129,7 +128,7 @@ private void initChannelTypes() {
else chRead = null;
if (ch instanceof WritableByteChannel) chWrite = (WritableByteChannel)ch;
else chWrite = null;
if (ch instanceof SeekableByteChannel) chSeek = (SeekableByteChannel)ch;
if (ch instanceof FileChannel) chSeek = (FileChannel)ch;
else chSeek = null;
if (ch instanceof SelectableChannel) chSelect = (SelectableChannel)ch;
else chSelect = null;
Expand All @@ -153,7 +152,7 @@ private void initChannelTypes() {
public Channel ch;
public ReadableByteChannel chRead;
public WritableByteChannel chWrite;
public SeekableByteChannel chSeek;
public FileChannel chSeek;
public SelectableChannel chSelect;
public FileChannel chFile;
public SocketChannel chSock;
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/java/org/jruby/util/io/OpenFile.java
Expand Up @@ -38,7 +38,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.FileChannel;
import java.nio.channels.SelectableChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
Expand Down Expand Up @@ -1325,7 +1325,7 @@ boolean waitReadable(ThreadContext context, ChannelFD fd) {

// kinda-hacky way to see if there's more data to read from a seekable channel
if (fd.chSeek != null) {
SeekableByteChannel fdSeek = fd.chSeek;
FileChannel fdSeek = fd.chSeek;
try {
// not a real file, can't get size...we'll have to just read and block
if (fdSeek.size() < 0) return true;
Expand Down Expand Up @@ -2101,7 +2101,7 @@ public WritableByteChannel writeChannel() {
return fd.chWrite;
}

public SeekableByteChannel seekChannel() {
public FileChannel seekChannel() {
return fd.chSeek;
}

Expand Down

0 comments on commit e712294

Please sign in to comment.