writeText (Stream - Java)

Writes text to a stream.

Defined in



public int writeText(String text)
    throws NotesException
public int writeText(String text, int endOfLine)
    throws NotesException


String text

The text to write, to a maximum of 2GB bytes.

int endOfLine

End-of-line character(s) appended to the text. The default is Stream.EOL_NONE.

  • Stream.EOL_CR (2) appends a carriage return (ASCII 13).
  • Stream.EOL_CRLF (0) appends a carriage return and line feed (ASCII 10 + 13).
  • Stream.EOL_LF (1) appends a line feed (ASCII 10).
  • Stream.EOL_NONE (5) appends nothing. Default.
  • Stream.EOL_PLATFORM (3) follows the conventions of the current platform.

Return value


The number of characters written.


This method appends the text to the end of the stream.

This method throws an exception if the stream is read-only. See IsReadOnly.

When a stream is written, property values are:

  • Bytes is incremented by the number of bytes read
  • IsEOS is true
  • Position is set at end of stream

If the stream is opened on an empty file and the character set is Unicode, UTF-16, UTF-16BE, or UTF-16LE, this method writes byte order mark or signature bytes at the beginning of the stream. These bytes are transparent upon subsequent accesses of the stream with the same character set.