InternalBufferOverflowException 클래스

정의

내부 버퍼가 오버플로될 때 throw되는 예외입니다.

public ref class InternalBufferOverflowException : SystemException
public class InternalBufferOverflowException : SystemException
[System.Serializable]
public class InternalBufferOverflowException : SystemException
type InternalBufferOverflowException = class
    inherit SystemException
[<System.Serializable>]
type InternalBufferOverflowException = class
    inherit SystemException
Public Class InternalBufferOverflowException
Inherits SystemException
상속
InternalBufferOverflowException
특성

예제

다음 예제에는 파일 변경을 모니터링 하려면 FileSystemWatcher를 만드는 방법을 보여 줍니다 (만듭니다, 삭제, 이름 바꾸기, 변경 내용) 디스크 드라이브에 발생 합니다. 이 예제에는 오류 알림을 받는 방법을 보여 줍니다.

using System;
using System.IO;

class Program
{
    static void Main(string[] args)
    {
        //  Create a FileSystemWatcher to monitor all files on drive C.
        FileSystemWatcher fsw = new FileSystemWatcher("C:\\");

        //  Watch for changes in LastAccess and LastWrite times, and
        //  the renaming of files or directories.
        fsw.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite
            | NotifyFilters.FileName |NotifyFilters.DirectoryName;

        //  Register a handler that gets called when a
        //  file is created, changed, or deleted.
        fsw.Changed += new FileSystemEventHandler(OnChanged);

        fsw.Created += new FileSystemEventHandler(OnChanged);

        fsw.Deleted += new FileSystemEventHandler(OnChanged);

        //  Register a handler that gets called when a file is renamed.
        fsw.Renamed += new RenamedEventHandler(OnRenamed);

        //  Register a handler that gets called if the
        //  FileSystemWatcher needs to report an error.
        fsw.Error += new ErrorEventHandler(OnError);

        //  Begin watching.
        fsw.EnableRaisingEvents = true;

        Console.WriteLine("Press \'Enter\' to quit the sample.");
        Console.ReadLine();
    }

    //  This method is called when a file is created, changed, or deleted.
    private static void OnChanged(object source, FileSystemEventArgs e)
    {
        //  Show that a file has been created, changed, or deleted.
        WatcherChangeTypes wct = e.ChangeType;
        Console.WriteLine("File {0} {1}", e.FullPath, wct.ToString());
    }

    //  This method is called when a file is renamed.
    private static void OnRenamed(object source, RenamedEventArgs e)
    {
        //  Show that a file has been renamed.
        WatcherChangeTypes wct = e.ChangeType;
        Console.WriteLine("File {0} {2} to {1}", e.OldFullPath, e.FullPath, wct.ToString());
    }

    //  This method is called when the FileSystemWatcher detects an error.
    private static void OnError(object source, ErrorEventArgs e)
    {
        //  Show that an error has been detected.
        Console.WriteLine("The FileSystemWatcher has detected an error");
        //  Give more information if the error is due to an internal buffer overflow.
        if (e.GetException().GetType() == typeof(InternalBufferOverflowException))
        {
            //  This can happen if Windows is reporting many file system events quickly
            //  and internal buffer of the  FileSystemWatcher is not large enough to handle this
            //  rate of events. The InternalBufferOverflowException error informs the application
            //  that some of the file system events are being lost.
            Console.WriteLine(("The file system watcher experienced an internal buffer overflow: " + e.GetException().Message));
        }
    }
}
Imports System.IO

Module Module1
    Sub Main()
        ' Create a FileSystemWatcher to monitor all files on drive C.
        Dim fsw As New FileSystemWatcher("C:\")

        ' Watch for changes in LastAccess and LastWrite times, and
        ' the renaming of files or directories. 
        fsw.NotifyFilter = (NotifyFilters.LastAccess Or NotifyFilters.LastWrite _ 
            Or NotifyFilters.FileName Or NotifyFilters.DirectoryName)

        ' Register a handler that gets called when a 
        ' file is created, changed, or deleted.
        AddHandler fsw.Changed, New FileSystemEventHandler(AddressOf OnChanged)

        ' The commented line of code below is a shorthand of the above line.
        ' AddHandler fsw.Changed, AddressOf OnChanged

        ' NOTE: The shorthand version is used in the remainder of this code.
        ' FileSystemEventHandler
        AddHandler fsw.Created, AddressOf OnChanged 
        ' FileSystemEventHandler
        AddHandler fsw.Deleted, AddressOf OnChanged

        ' Register a handler that gets called when a file is renamed.
        ' RenamedEventHandler
        AddHandler fsw.Renamed, AddressOf OnRenamed

        ' Register a handler that gets called if the 
        ' FileSystemWatcher needs to report an error.
        ' ErrorEventHandler
        AddHandler fsw.Error, AddressOf OnError

        ' Begin watching.
        fsw.EnableRaisingEvents = True

        ' Wait for the user to quit the program.
        Console.WriteLine("Press 'Enter' to quit the sample.")
        Console.ReadLine()
    End Sub

    ' This method is called when a file is created, changed, or deleted.
    Private Sub OnChanged(ByVal source As Object, ByVal e As FileSystemEventArgs)

        ' Show that a file has been created, changed, or deleted.
        Dim wct As WatcherChangeTypes = e.ChangeType
        Console.WriteLine("File {0} {1}", e.FullPath, wct.ToString())
    End Sub

    ' This method is called when a file is renamed.
    Private Sub OnRenamed(ByVal source As Object, ByVal e As RenamedEventArgs)

        ' Show that a file has been renamed.
        Dim wct As WatcherChangeTypes = e.ChangeType
        Console.WriteLine("File {0} {2} to {1}", e.OldFullPath, e.FullPath, wct.ToString())
    End Sub

    ' This method is called when the FileSystemWatcher detects an error.
    Private Sub OnError(ByVal source As Object, ByVal e As ErrorEventArgs)

        ' Show that an error has been detected.
        Console.WriteLine("The FileSystemWatcher has detected an error")

        ' Give more information if the error is due to an internal buffer overflow.
        If TypeOf e.GetException Is InternalBufferOverflowException Then
            ' This can happen if Windows is reporting many file system events quickly 
            ' and internal buffer of the  FileSystemWatcher is not large enough to handle this
            ' rate of events. The InternalBufferOverflowException error informs the application
            ' that some of the file system events are being lost.
            Console.WriteLine( _
                "The file system watcher experienced an internal buffer overflow: " _
                + e.GetException.Message)
        End If
    End Sub
End Module

설명

FileSystemWatcher알림이 변경 파일 시스템 저장소 버퍼 구성 요소에에서 변경 사항을 만들고 애플리케이션 프로그래밍 인터페이스 (Api)에 전달 하는 경우. 짧은 시간에 많은 변경 내용이 있는 경우 버퍼가 쉽게 오버플로될 수 있으므로 예외가 throw되어 기본적으로 모든 변경 내용이 손실됩니다. 버퍼가 오버플로되지 않도록 하려면 해당 및 FileSystemWatcher.IncludeSubdirectories 속성을 사용하여 FileSystemWatcher.NotifyFilter 원치 않는 변경 알림을 필터링합니다. 속성을 통해 FileSystemWatcher.InternalBufferSize 내부 버퍼의 크기를 늘릴 수도 있습니다. 그러나 버퍼 크기를 늘리면 비용이 많이 들므로 버퍼를 가능한 한 작게 유지합니다.

생성자

InternalBufferOverflowException()

InternalBufferOverflowException 클래스의 새로운 기본 인스턴스를 초기화합니다.

InternalBufferOverflowException(SerializationInfo, StreamingContext)

지정된 InternalBufferOverflowExceptionSerializationInfo 개체를 사용하여 serialize할 수 있는 StreamingContext 클래스의 비어 있는 새 인스턴스를 초기화합니다.

InternalBufferOverflowException(String)

표시될 오류 메시지를 지정한 상태에서 InternalBufferOverflowException 클래스의 새 인스턴스를 초기화합니다.

InternalBufferOverflowException(String, Exception)

표시될 메시지 및 생성되는 내부 예외를 지정한 상태에서 InternalBufferOverflowException 클래스의 새 인스턴스를 초기화합니다.

속성

Data

예외에 대한 사용자 정의 정보를 추가로 제공하는 키/값 쌍 컬렉션을 가져옵니다.

(다음에서 상속됨 Exception)
HelpLink

이 예외와 연결된 도움말 파일에 대한 링크를 가져오거나 설정합니다.

(다음에서 상속됨 Exception)
HResult

특정 예외에 할당된 코드화된 숫자 값인 HRESULT를 가져오거나 설정합니다.

(다음에서 상속됨 Exception)
InnerException

현재 예외를 발생시킨 Exception 인스턴스를 가져옵니다.

(다음에서 상속됨 Exception)
Message

현재 예외를 설명하는 메시지를 가져옵니다.

(다음에서 상속됨 Exception)
Source

오류를 발생시키는 애플리케이션 또는 개체의 이름을 가져오거나 설정합니다.

(다음에서 상속됨 Exception)
StackTrace

호출 스택의 직접 실행 프레임 문자열 표현을 가져옵니다.

(다음에서 상속됨 Exception)
TargetSite

현재 예외를 throw하는 메서드를 가져옵니다.

(다음에서 상속됨 Exception)

메서드

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetBaseException()

파생 클래스에서 재정의된 경우 하나 이상의 후속 예외의 근본 원인이 되는 Exception 을 반환합니다.

(다음에서 상속됨 Exception)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetObjectData(SerializationInfo, StreamingContext)

파생 클래스에서 재정의된 경우 예외에 관한 정보를 SerializationInfo 에 설정합니다.

(다음에서 상속됨 Exception)
GetType()

현재 인스턴스의 런타임 형식을 가져옵니다.

(다음에서 상속됨 Exception)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 예외에 대한 문자열 표현을 만들고 반환합니다.

(다음에서 상속됨 Exception)

이벤트

SerializeObjectState
사용되지 않습니다.

예외에 대한 serialize된 데이터가 들어 있는 예외 상태 개체가 만들어지도록 예외가 serialize될 때 발생합니다.

(다음에서 상속됨 Exception)

적용 대상

추가 정보