StreamReader.ReadBlock Método
Definição
Sobrecargas
| ReadBlock(Span<Char>) |
Lê os caracteres do fluxo atual e grava os dados em um buffer.Reads the characters from the current stream and writes the data to a buffer. |
| ReadBlock(Char[], Int32, Int32) |
Lê um máximo especificado de caracteres do fluxo atual e grava os dados em um buffer, começando no índice especificado.Reads a specified maximum number of characters from the current stream and writes the data to a buffer, beginning at the specified index. |
ReadBlock(Span<Char>)
Lê os caracteres do fluxo atual e grava os dados em um buffer.Reads the characters from the current stream and writes the data to a buffer.
public:
override int ReadBlock(Span<char> buffer);
public override int ReadBlock (Span<char> buffer);
override this.ReadBlock : Span<char> -> int
Public Overrides Function ReadBlock (buffer As Span(Of Char)) As Integer
Parâmetros
Quando este método é retornado, contém o intervalo de caracteres especificado substituídos pelos caracteres lidos da origem atual.When this method returns, contains the specified span of characters replaced by the characters read from the current source.
Retornos
O número de caracteres que foram lidos.The number of characters that have been read. O número será menor ou igual ao comprimento de buffer, dependendo se todos os caracteres de entrada tiverem sido lidos.The number will be less than or equal to the buffer length, depending on whether all input characters have been read.
Exceções
buffer é null.buffer is null.
O StreamReader está fechado.The StreamReader is closed.
Ocorreu um erro de E/S.An I/O error occurred.
Aplica-se a
ReadBlock(Char[], Int32, Int32)
Lê um máximo especificado de caracteres do fluxo atual e grava os dados em um buffer, começando no índice especificado.Reads a specified maximum number of characters from the current stream and writes the data to a buffer, beginning at the specified index.
public:
override int ReadBlock(cli::array <char> ^ buffer, int index, int count);
public override int ReadBlock (char[] buffer, int index, int count);
override this.ReadBlock : char[] * int * int -> int
Public Overrides Function ReadBlock (buffer As Char(), index As Integer, count As Integer) As Integer
Parâmetros
- buffer
- Char[]
Quando esse método é retornado, ele contém a matriz de caracteres especificada com os valores entre index e (índice + contagem -1) substituídos pelos caracteres lidos da origem atual.When this method returns, contains the specified character array with the values between index and (index + count - 1) replaced by the characters read from the current source.
- index
- Int32
A posição em buffer na qual a gravação será iniciada.The position in buffer at which to begin writing.
- count
- Int32
O número máximo de caracteres a serem lidos.The maximum number of characters to read.
Retornos
O número de caracteres que foram lidos.The number of characters that have been read. O número será menor ou igual a count, dependendo se todos os caracteres de entrada tiverem sido lidos.The number will be less than or equal to count, depending on whether all input characters have been read.
Exceções
buffer é null.buffer is null.
O tamanho do buffer menos index é menor que count.The buffer length minus index is less than count.
index ou count é negativo.index or count is negative.
O StreamReader está fechado.The StreamReader is closed.
Ocorreu um erro de E/S.An I/O error occurred.
Comentários
A posição do fluxo subjacente é avançada pelo número de caracteres que foram lidos em buffer .The position of the underlying stream is advanced by the number of characters that were read into buffer.
O método é bloqueado até que count os caracteres sejam lidos ou o final do fluxo tenha sido atingido.The method blocks until either count characters are read, or the end of the stream has been reached. Esta é uma versão de bloqueio do Read .This is a blocking version of Read.