# File lib/net/sftp/protocol/01/impl.rb, line 143
    def open( id, path, flags, mode=0660 )
      sftp_flags = case
        when ( flags & IO::WRONLY ) != 0 then F_WRITE
        when ( flags & IO::RDWR   ) != 0 then F_READ | F_WRITE
        when ( flags & IO::APPEND ) != 0 then F_APPEND
        else F_READ
      end

      sftp_flags |= F_CREAT if ( flags & IO::CREAT ) != 0
      sftp_flags |= F_TRUNC if ( flags & IO::TRUNC ) != 0
      sftp_flags |= F_EXCL  if ( flags & IO::EXCL  ) != 0

      attributes = @attr_factory.empty
      attributes.permissions = mode

      open_raw id, path, sftp_flags, attributes
    end