FileNotOpen() static private method

static private FileNotOpen ( ) : void
return void
Exemplo n.º 1
0
 private void CheckHandle()
 {
     if (_handle == null)
     {
         InternalResources.FileNotOpen();
     }
 }
Exemplo n.º 2
0
 // Flush dumps the contents of the serial driver's internal read and write buffers.
 // We actually expose the functionality for each, but fulfilling Stream's contract
 // requires a Flush() method.  Fails if handle closed.
 // Note: Serial driver's write buffer is *already* attempting to write it, so we can only wait until it finishes.
 public override void Flush()
 {
     if (_handle == null)
     {
         InternalResources.FileNotOpen();
     }
     Interop.Termios.TermiosDiscard(_handle, Interop.Termios.Queue.AllQueues);
 }
Exemplo n.º 3
0
        internal void SetBufferSizes(int readBufferSize, int writeBufferSize)
        {
            if (_handle == null)
            {
                InternalResources.FileNotOpen();
            }

            // Ignore for now.
        }
Exemplo n.º 4
0
 internal void DiscardOutBuffer()
 {
     if (_handle == null)
     {
         InternalResources.FileNotOpen();
     }
     // This may or may not work depending on hardware.
     Interop.Termios.TermiosDiscard(_handle, Interop.Termios.Queue.SendQueue);
 }
Exemplo n.º 5
0
        // Flush dumps the contents of the serial driver's internal read and write buffers.
        // We actually expose the functionality for each, but fulfilling Stream's contract
        // requires a Flush() method.  Fails if handle closed.
        // Note: Serial driver's write buffer is *already* attempting to write it, so we can only wait until it finishes.
        public override void Flush()
        {
            if (_handle == null)
            {
                InternalResources.FileNotOpen();
            }

            SpinWait sw = default;

            while (!_writeQueue.IsEmpty)
            {
                sw.SpinOnce();
            }

            Interop.Termios.TermiosDrain(_handle);
        }
Exemplo n.º 6
0
 private void CheckReadWriteArguments(byte[] array, int offset, int count)
 {
     if (array == null)
     {
         throw new ArgumentNullException(nameof(array));
     }
     if (offset < 0)
     {
         throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_NeedNonNegNumRequired);
     }
     if (count < 0)
     {
         throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNumRequired);
     }
     if (array.Length - offset < count)
     {
         throw new ArgumentException(SR.Argument_InvalidOffLen);
     }
     if (_handle == null)
     {
         InternalResources.FileNotOpen();
     }
 }