MemoryStream.ReadByte Método
Definição
Lê um byte do fluxo atual.Reads a byte from the current stream.
public:
override int ReadByte();
public override int ReadByte ();
override this.ReadByte : unit -> int
Public Overrides Function ReadByte () As Integer
Retornos
O byte é convertido em um Int32 ou -1, se o fim do fluxo tiver sido atingido.The byte cast to a Int32, or -1 if the end of the stream has been reached.
Exceções
A instância atual do fluxo está fechada.The current stream instance is closed.
Exemplos
Este exemplo de código faz parte de um exemplo maior fornecido para a MemoryStream classe.This code example is part of a larger example provided for the MemoryStream class.
// Read the remaining bytes, byte by byte.
while ( count < memStream->Length )
{
byteArray[ count++ ] = Convert::ToByte( memStream->ReadByte() );
}
// Read the remaining bytes, byte by byte.
while(count < memStream.Length)
{
byteArray[count++] =
Convert.ToByte(memStream.ReadByte());
}
' Read the remaining Bytes, Byte by Byte.
While(count < memStream.Length)
byteArray(count) = _
Convert.ToByte(memStream.ReadByte())
count += 1
End While
Comentários
Este método substitui ReadByte.This method overrides ReadByte.
Se a operação de leitura for bem-sucedida, a posição atual dentro do fluxo será avançada por um byte.If the read operation is successful, the current position within the stream is advanced by one byte. Se ocorrer uma exceção, a posição atual dentro do fluxo será inalterada.If an exception occurs, the current position within the stream is unchanged.