open (Stream - Java)

Associates a file with a stream.

Defined in



public boolean open(String pathname)
    throws NotesException
public boolean open(String pathname, String charset)
    throws NotesException


String pathname

The full path name of a file. Must be valid for the current platform.

String charset

The character set used by the file. The character set that describes the file content. Defaults to "System."

Return value

  • true if the file opens successfully.
  • false if the open fails. See the usage notes.


This method creates the file if it does not exist.

When a stream is opened, property values are:

  • Bytes is 0 for a new file and the number of bytes in the file for an existing file.
  • Charset is as specified for charset.
  • IsEOS is true if the stream is empty; otherwise, it is false.
  • IsReadOnly is true if the file is read-only, false if the file is read-write.
  • Position is 0.

It is recommended that you call Close when you are finished processing the stream.

Valid character sets include: ASCII, Big5, Binary, EUC-JP, EUC-KR, EUC-TW, GF2312, ISO-2022-JP, ISO-2022-KR, ISO-8859-1 through ISO-8859-9, ISO-8859-15, KOI8-R, Latin4, Shift-JIS, System, TCVN3, Unicode, Unicode-1-1, US-ASCII, UTF-7, UTF-8, UTF-16, UTF-16BE, UTF-16LE, Windows-1250 through Windows-1258, and Windows-874. Binary implies byte operations only on the stream. Unicode is the same as UTF-16 and Unicode-1-1 is a compatible subset of UTF-16.

This method fails if:

  • The path name is not valid.
  • The stream is already open.
  • The stream has content.
  • The charset parameter is not a valid character set.