HttpResponse.BinaryWrite(Byte[]) Metodo

Definizione

Scrive una stringa di caratteri binari nel flusso di output HTTP.

public:
 void BinaryWrite(cli::array <System::Byte> ^ buffer);
public void BinaryWrite (byte[] buffer);
member this.BinaryWrite : byte[] -> unit
Public Sub BinaryWrite (buffer As Byte())

Parametri

buffer
Byte[]

Byte da scrivere nel flusso di output.

Esempio

L'esempio seguente legge un file di testo in un buffer e scrive il buffer nel flusso di output HTTP.

FileStream MyFileStream;
 long FileSize;

 MyFileStream = new FileStream("sometext.txt", FileMode.Open);
 FileSize = MyFileStream.Length;

 byte[] Buffer = new byte[(int)FileSize];
 MyFileStream.Read(Buffer, 0, (int)FileSize);
 MyFileStream.Close();

 Response.Write("<b>File Contents: </b>");
 Response.BinaryWrite(Buffer);

Dim MyFileStream As FileStream
 Dim FileSize As Long
 
 MyFileStream = New FileStream("sometext.txt", FileMode.Open)
 FileSize = MyFileStream.Length
 
 Dim Buffer(CInt(FileSize)) As Byte
 MyFileStream.Read(Buffer, 0, CInt(FileSize))
 MyFileStream.Close()
 
 Response.Write("<b>File Contents: </b>")
 Response.BinaryWrite(Buffer)
    

Si applica a