[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Classes' (#rtl)

# TStream.Write

Writes data from a buffer to the stream and returns the number of bytes written.

## Declaration

Source position: classesh.inc line 846

`public function TStream.Write(`
`const Buffer;`
`Count: LongInt`
`):LongInt; virtual;`

## Description

Write attempts to write Count bytes from Buffer to the stream. It returns the actual number of bytes written to the stream.

This method should be used when the number of bytes that should be written is not determined. If a specific number of bytes should be written, use TSTream.WriteBuffer instead.

As implemented in TStream, Write does nothing but raises EStreamError exception to indicate that writing is not supported. Descendent classes that allow writing must override this method to do the actual writing.

## Errors

In case a descendent class does not allow writing to the stream, an exception is raised.

## See also

TStream.Read |  | Reads data from the stream to a buffer and returns the number of bytes read.
TStream.WriteBuffer |  | Writes data from a buffer to the stream

Documentation generated on: Feb 26 2014