dw.io
Class FileWriter
Object
dw.io.Writer
dw.io.FileWriter
Convenience class for writing character files.

Files are stored in a shared file system where multiple processes could access the same file. The client code is responsible for ensuring that no more than one process writes to a file at a given time.

Note: when this class is used with sensitive data, be careful in persisting sensitive information to disk.

Properties
lineSeparator  :  String
Get the current line separator (e.g. '\n' or '\r\n'), if no value is set the system default '\n' will be used.
Constructor Summary
FileWriter(file : File)
Constructs the writer for the specified file.
FileWriter(file : File, append : boolean)
Constructs the writer for the specified file.
FileWriter(file : File, encoding : String)
Constructs the writer for the specified file with the specified encoding.
FileWriter(file : File, encoding : String, append : boolean)
Constructs the writer for the specified file with the specified encoding.
Method Summary
close() : void
Closes the writer.
getLineSeparator() : String
Get the current line separator (e.g.
setLineSeparator(lineSeparator : String) : void
Set the line separator (e.g.
writeLine(str : String) : void
Writes the specified line and appends the line separator.
Methods inherited from class Writer
Salesforce Commerce Cloud Courses
Salesforce B2C Commerce Developer - Certification Tests
Why risk failing the SFCC exam? Get 180 real questions, killer content, and everything you need to crush the Salesforce B2C Commerce Developer certification.

Becoming a Salesforce B2C Commerce Developer is your ticket to higher salaries, better job opportunities, and the credibility to stand out from the competition. But let's be honestβ€”passing the certification exam isn't easy. That's where we come in.
Salesforce Javascript Developer I - Certification Tests
Not just another prep courseβ€”this is your shortcut to passing. Master JavaScript for Salesforce and go from 'hoping to pass' to knowing you will. Ready to start?

This isn't just another prep courseβ€”it's your shortcut to mastering the skills and confidence you need to pass. With multiple practice tests covering every section and a final exam simulation designed to mirror the real thing, you'll feel like you've already aced it before test day.
Salesforce B2C Commerce Architect - Certification Tests
Think the Developer exam was hard? Welcome to the next level.

The Salesforce B2C Commerce Architect certification is a whole different gameβ€”complex solutions, elevated difficulty, and skills that set you apart in the eCommerce industry. That's why we're including 11 downloadable PDF guides, packed with best practices and strategies to help you prepare for the exam and build confidence in every topic.
Constructor Detail
FileWriter
public FileWriter(file : File)
Constructs the writer for the specified file. Uses "UTF-8" as encoding.

To release system resources, close the writer by calling close().

Parameters:
file - the file object to write to.

FileWriter
public FileWriter(file : File, append : boolean)
Constructs the writer for the specified file. Optional file append mode is supported. Uses "UTF-8" as encoding.

To release system resources, close the writer by calling close().

Parameters:
file - the file object to write to.
append - flag, whether the file should be written in append mode

FileWriter
public FileWriter(file : File, encoding : String)
Constructs the writer for the specified file with the specified encoding.

To release system resources, close the writer by calling close().

Parameters:
file - the file object to write to.
encoding - the character encoding to use.

FileWriter
public FileWriter(file : File, encoding : String, append : boolean)
Constructs the writer for the specified file with the specified encoding. Optional file append mode is supported.

To release system resources, close the writer by calling close().

Parameters:
file - the file object to write to.
encoding - the character encoding to use.
append - flag indicating whether the file should be written in append mode.

Method Detail
close
close() : void
Closes the writer.

getLineSeparator
getLineSeparator() : String
Get the current line separator (e.g. '\n' or '\r\n'), if no value is set the system default '\n' will be used.

setLineSeparator
setLineSeparator(lineSeparator : String) : void
Set the line separator (e.g. '\n' or '\r\n'), if no value is set the system default '\n' will be used.
Parameters:
lineSeparator - that will be written at the end of each line

writeLine
writeLine(str : String) : void
Writes the specified line and appends the line separator.
Parameters:
str - the line to write to the file.

β™₯
Notifications pending to read