文档中心

关于 SequoiaDB

快速入门

安装

基本操作

数据模型

SQL引擎

S3引擎

系统架构

数据库管理

连接器

驱动

参考手册

故障排除

SAC 管控中心

Web服务

版本信息

writeContent()

语法

File.writeContent( <fileContent> )

类别

File

描述

将 fileContent 对象中的二进制内容写入文件中。

参数

参数名 参数类型 默认值 描述 是否必填
fileContent fileContent 对象 --- 往文件中写入的 fileContent 的二进制内容

返回值

无返回值。

错误

如果出错则抛异常,并输出错误信息,可以通过getLastErrMsg()获取错误信息或通过getLastError()获取错误码。 关于错误处理可以参考常见错误处理指南

常见错误可参考错误码

示例

  • 打开一个二进制文件,获取文件描述符;

    > var file = new File( "/opt/sequoiadb/file.dump" )
  • 读取二进制文件的内容并存入 fileContent 对象中;

    > var content = file.readContent()
    > content instanceof FileContent
    true
  • 往文件中写入 fileContent 对象中的二进制内容。

    > var file2 = new File( "/opt/sequoiadb/file2.dump" )
    > file2.writeContent( content )
回到顶部