public Channel getChannel() { return getDescriptor().getChannel(); }
public Channel getChannel() { return getDescriptor().getChannel(); }
public Channel getChannel() { return getDescriptor().getChannel(); }
public Channel getChannel() { return getDescriptor().getChannel(); }
stream.buffer.put(bytes, off, len); } else if (stream.getDescriptor().getChannel() instanceof SelectableChannel) { SelectableChannel ch = (SelectableChannel) stream.getDescriptor().getChannel(); synchronized (ch.blockingLock()) { boolean oldBlocking = ch.isBlocking();
stream.buffer.put(bytes, off, len); } else if (stream.getDescriptor().getChannel() instanceof SelectableChannel) { SelectableChannel ch = (SelectableChannel) stream.getDescriptor().getChannel(); synchronized (ch.blockingLock()) { boolean oldBlocking = ch.isBlocking();
stream.buffer.put(bytes, off, len); } else if (stream.getDescriptor().getChannel() instanceof SelectableChannel) { SelectableChannel ch = (SelectableChannel) stream.getDescriptor().getChannel(); synchronized (ch.blockingLock()) { boolean oldBlocking = ch.isBlocking();
if (available >= len) { return stream.copyBufferedBytes(bytes, off, len); } else if (stream.getDescriptor().getChannel() instanceof SelectableChannel) { SelectableChannel ch = (SelectableChannel) stream.getDescriptor().getChannel(); synchronized (ch.blockingLock()) { boolean oldBlocking = ch.isBlocking();
stream.buffer.put(bytes, off, len); } else if (stream.getDescriptor().getChannel() instanceof SelectableChannel) { SelectableChannel ch = (SelectableChannel) stream.getDescriptor().getChannel(); synchronized (ch.blockingLock()) { boolean oldBlocking = ch.isBlocking();
if (available >= len) { return stream.copyBufferedBytes(bytes, off, len); } else if (stream.getDescriptor().getChannel() instanceof SelectableChannel) { SelectableChannel ch = (SelectableChannel) stream.getDescriptor().getChannel(); synchronized (ch.blockingLock()) { boolean oldBlocking = ch.isBlocking();
if (available >= len) { return stream.copyBufferedBytes(bytes, off, len); } else if (stream.getDescriptor().getChannel() instanceof SelectableChannel) { SelectableChannel ch = (SelectableChannel) stream.getDescriptor().getChannel(); synchronized (ch.blockingLock()) { boolean oldBlocking = ch.isBlocking();
if (available >= len) { return stream.copyBufferedBytes(bytes, off, len); } else if (stream.getDescriptor().getChannel() instanceof SelectableChannel) { SelectableChannel ch = (SelectableChannel) stream.getDescriptor().getChannel(); synchronized (ch.blockingLock()) { boolean oldBlocking = ch.isBlocking();
@JRubyMethod(required = 1) public static IRubyObject initialize(IRubyObject recv, IRubyObject io) { try { if (io instanceof RubyIO) { RubyIO rubyIO = (RubyIO)io; OpenFile of = rubyIO.getOpenFile(); Stream stream = of.getMainStreamSafe(); if (stream instanceof ChannelStream) { ChannelStream cStream = (ChannelStream)stream; if (cStream.getDescriptor().getChannel() instanceof SelectableChannel) { SelectableChannel selChannel = (SelectableChannel)cStream.getDescriptor().getChannel(); ((RubyObject)recv).extend( new IRubyObject[]{((RubyModule)recv.getRuntime().getModule("Net").getConstant("BufferedIO")).getConstant("NativeImplementation")}); SelectableChannel sc = (SelectableChannel)(selChannel); recv.dataWrapStruct(new NativeImpl(sc)); } } } recv.getInstanceVariables().setInstanceVariable("@io", io); recv.getInstanceVariables().setInstanceVariable("@read_timeout", recv.getRuntime().newFixnum(60)); recv.getInstanceVariables().setInstanceVariable("@debug_output", recv.getRuntime().getNil()); recv.getInstanceVariables().setInstanceVariable("@rbuf", RubyString.newEmptyString(recv.getRuntime())); return recv; } catch (BadDescriptorException e) { throw recv.getRuntime().newErrnoEBADFError(); } }
@JRubyMethod(required = 1) public static IRubyObject initialize(IRubyObject recv, IRubyObject io) { try { if (io instanceof RubyIO) { RubyIO rubyIO = (RubyIO)io; OpenFile of = rubyIO.getOpenFile(); Stream stream = of.getMainStreamSafe(); if (stream instanceof ChannelStream) { ChannelStream cStream = (ChannelStream)stream; if (cStream.getDescriptor().getChannel() instanceof SelectableChannel) { SelectableChannel selChannel = (SelectableChannel)cStream.getDescriptor().getChannel(); ((RubyObject)recv).extend( new IRubyObject[]{((RubyModule)recv.getRuntime().getModule("Net").getConstant("BufferedIO")).getConstant("NativeImplementation")}); SelectableChannel sc = (SelectableChannel)(selChannel); recv.dataWrapStruct(new NativeImpl(sc)); } } } recv.getInstanceVariables().setInstanceVariable("@io", io); recv.getInstanceVariables().setInstanceVariable("@read_timeout", recv.getRuntime().newFixnum(60)); recv.getInstanceVariables().setInstanceVariable("@debug_output", recv.getRuntime().getNil()); recv.getInstanceVariables().setInstanceVariable("@rbuf", RubyString.newEmptyString(recv.getRuntime())); return recv; } catch (BadDescriptorException e) { throw recv.getRuntime().newErrnoEBADFError(); } }