OracleBFile.Seek(Int64, SeekOrigin) Método

Definição

Define a posição no fluxo OracleBFile atual.Sets the position on the current OracleBFile stream.

public:
 override long Seek(long offset, System::IO::SeekOrigin origin);
public override long Seek (long offset, System.IO.SeekOrigin origin);
override this.Seek : int64 * System.IO.SeekOrigin -> int64
Public Overrides Function Seek (offset As Long, origin As SeekOrigin) As Long

Parâmetros

offset
Int64

Um deslocamento de bytes relativo à origem.A byte offset relative to origin. Se offset for negativo, a nova posição precederá a posição especificada pela origin pelo número de bytes especificado por offset.If offset is negative, the new position will precede the position specified by origin by the number of bytes specified by offset. Se offset for zero, a nova posição será a posição especificada pela origin.If offset is zero, the new position will be the position specified by origin. Se offset for positivo, a nova posição seguirá a posição especificada pela origin pelo número de bytes especificado por offset.If offset is positive, the new position will follow the position specified by origin by the number of bytes specified by offset.

origin
SeekOrigin

Um valor do tipo System.IO.SeekOrigin indicando o ponto de referência usado para obter a nova posição.A value of type System.IO.SeekOrigin indicating the reference point used to obtain the new position.

Retornos

Int64

A nova posição dentro do fluxo atual.The new position within the current stream.

Exceções

Tentou definir uma posição com um valor negativo ou maior que o comprimento do fluxo.Attempted to set a position with a negative value or greater than the length of the stream.

Os métodos foram chamados depois que o fluxo foi fechado ou descartado.Methods were called after the stream was closed or disposed.

Comentários

Se offset for negativo, a nova posição será necessária para preceder a posição especificada pelo origin número de bytes especificado por offset .If offset is negative, the new position is required to precede the position specified by origin by the number of bytes specified by offset. Se offset for zero, a nova posição será necessária para ser a posição especificada por origin .If offset is zero, the new position is required to be the position specified by origin. Se offset for positivo, a nova posição será necessária para seguir a posição especificada pelo origin número de bytes especificados por offset .If offset is positive, the new position is required to follow the position specified by origin by the number of bytes specified by offset.

Não há suporte para a busca de qualquer local além do comprimento do fluxo.Seeking to any location beyond the length of the stream is not supported.

Qualquer tentativa de acessar um fechado OracleBFile usando os Read Seek métodos ou reabrirá OracleBFile automaticamente um fluxo.Any attempt to access a closed OracleBFile using the Read or Seek methods reopens an OracleBFile stream automatically.

O exemplo C# a seguir pressupõe esse esquema em uma tabela Oracle:The following C# example assumes this schema in an Oracle table:

(col1 number, col2 BFILE)  

O exemplo demonstra como usar Read os Seek métodos e para acessar um OracleBFile objeto.The example demonstrates using the Read and Seek methods to access an OracleBFile object.

byte[] buffer = new byte[100];  
OracleDataReader dataReader = command.ExecuteReader();  
using (dataReader) {  
    if (dataReader.Read()) {  
            OracleBFile BFile = dataReader.GetOracleBFile(1);  
        using (BFile) {  
            BFile.Seek(0, SeekOrigin.Begin);  
            BFile.Read(buffer, 0, 100);  
        }  
    }  
}  

Aplica-se a