FileNotOpen() static private méthode

static private FileNotOpen ( ) : void
Résultat void
Exemple #1
0
 private void CheckHandle()
 {
     if (_handle == null)
     {
         InternalResources.FileNotOpen();
     }
 }
Exemple #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);
 }
        internal void SetBufferSizes(int readBufferSize, int writeBufferSize)
        {
            if (_handle == null)
            {
                InternalResources.FileNotOpen();
            }

            // Ignore for now.
        }
 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);
 }
        // 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);
        }
Exemple #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();
     }
 }