public RubyBufferedStream /*!*/ GetReadableStream() { var result = GetStream(); if (!_mode.CanRead()) { throw RubyExceptions.CreateIOError("not opened for reading"); } if (!result.CanRead) { throw RubyExceptions.CreateEBADF(); } return(result); }
public static RubyIO /*!*/ OpenPipe( RubyContext /*!*/ context, MutableString /*!*/ command, IOMode mode) { bool redirectStandardInput = mode.CanWrite(); bool redirectStandardOutput = mode.CanRead(); Process process = RubyProcess.CreateProcess(context, command, redirectStandardInput, redirectStandardOutput, false); StreamReader reader = null; StreamWriter writer = null; if (redirectStandardOutput) { reader = process.StandardOutput; } if (redirectStandardInput) { writer = process.StandardInput; } return(new RubyIO(context, reader, writer, mode)); }
private MutableString /*!*/ GetReadableContent() { if (!_mode.CanRead()) { throw RubyExceptions.CreateIOError("not opened for reading"); } return(_content); }
public static RubyIO/*!*/ OpenPipe( RubyContext/*!*/ context, MutableString/*!*/ command, IOMode mode) { bool redirectStandardInput = mode.CanWrite(); bool redirectStandardOutput = mode.CanRead(); Process process = RubyProcess.CreateProcess(context, command, redirectStandardInput, redirectStandardOutput, false); StreamReader reader = null; StreamWriter writer = null; if (redirectStandardOutput) { reader = process.StandardOutput; } if (redirectStandardInput) { writer = process.StandardInput; } return new RubyIO(context, reader, writer, mode); }
public static IOMode CloseWrite(this IOMode mode) { return((mode & ~IOMode.ReadWriteMask) | (mode.CanRead() ? IOMode.ReadOnly : IOMode.Closed)); }