dw.io
Class Reader
Object
dw.io.Reader
The class supports reading characters from a stream.
All Known Subclasses
Properties
lines  :  List  (Read Only)
The method reads the whole input stream, parses it and returns a list of strings.

Using this method on large feeds is inherently unsafe and may lead to an out-of-memory condition. Instead use method readLine() and process one line at a time.

Deprecated:
string  :  String  (Read Only)
The method reads the whole input stream as one string and returns it.

Using this method is unsafe if the length of the input stream is not known and may lead to an out-of-memory condition. Instead use method readN(Number).

Deprecated:
Constructor Summary
Reader(source : String)
Creates a reader from a string.
Reader(stream : InputStream)
Create a reader from a stream using UTF-8 character encoding.
Reader(stream : InputStream, encoding : String)
Create a reader from a stream using the specified character encoding.
Method Summary
close() : void
Closes the reader.
getLines() : List
The method reads the whole input stream, parses it and returns a list of strings.
getString() : String
The method reads the whole input stream as one string and returns it.
read() : String
Reads a single character from the stream.
read(length : Number) : String
Reads multiple characters from the stream as string.
readLine() : String
Reads the next line.
readLines() : List
The method reads the whole input stream, parses it and returns a list of strings.
readN(n : Number) : String
Reads n characters from the stream as string.
readString() : String
The method reads the whole input stream as one string and returns it.
ready() : boolean
Identifies if this stream is ready to be read.
skip(n : Number) : void
Skips the specified number of characters in the stream.
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
Reader
public Reader(source : String)
Creates a reader from a string.
Parameters:
source - the source string.

Reader
public Reader(stream : InputStream)
Create a reader from a stream using UTF-8 character encoding.
Parameters:
stream - the input stream to use.

Reader
public Reader(stream : InputStream, encoding : String)
Create a reader from a stream using the specified character encoding.
Parameters:
stream - the input stream to use.
encoding - the encoding to use.

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

getLines
getLines() : List
The method reads the whole input stream, parses it and returns a list of strings.

Using this method on large feeds is inherently unsafe and may lead to an out-of-memory condition. Instead use method readLine() and process one line at a time.

Deprecated:
Returns:
a list of strings

getString
getString() : String
The method reads the whole input stream as one string and returns it.

Using this method is unsafe if the length of the input stream is not known and may lead to an out-of-memory condition. Instead use method readN(Number).

Deprecated:
Returns:
a string, which represents the whole content of the InputStream
Throws:
IOException - if something went wrong while reading from the underlying stream

read
read() : String
Reads a single character from the stream. The method returns null if the end of the stream is reached.
Returns:
a single character in a string, or null if the end of the stream is reached

read
read(length : Number) : String
Reads multiple characters from the stream as string. The actual number of characters that were read can be determined from the length of the returned string. If the end of the stream is reached and no more characters can be read, the method exits with an exception.
Deprecated:
use readN(Number) instead which does not throw an exception if the stream is exhausted
Parameters:
length - the number of characters to read.
Returns:
a string whose length is controlled by the length parameter. The actual number of characters that were read can be determined from the length of the returned string.
Throws:
an - exception if the stream is exhausted

readLine
readLine() : String
Reads the next line.
Returns:
A String containing the contents of the line, not including any line termination characters, or null if the end of the stream has been reached.

readLines
readLines() : List
The method reads the whole input stream, parses it and returns a list of strings.

Using this method on large feeds is inherently unsafe and may lead to an out-of-memory condition. Instead use method readLine() and process one line at a time.

Returns:
a list of strings

readN
readN(n : Number) : String
Reads n characters from the stream as string. The actual number of characters that were read can be determined from the length of the returned string. If the end of the stream is reached and no more characters can be read, the method returns null.
Parameters:
n - the number of characters to read
Returns:
a string whose maximum length is controlled by the n parameter, or null if the end of the stream is reached and no more characters can be read

readString
readString() : String
The method reads the whole input stream as one string and returns it.

Using this method is unsafe if the length of the input stream is not known and may lead to an out-of-memory condition. Instead use method readN(Number).

Returns:
a string, which represents the whole content of the InputStream
Throws:
IOException - if something went wrong while reading from the underlying stream

ready
ready() : boolean
Identifies if this stream is ready to be read.
Returns:
true guarantees that the stream is ready to read without waiting for input. A false response means that the stream may or may not block to wait for input. Note that returning false does not guarantee that the next read() will block.

skip
skip(n : Number) : void
Skips the specified number of characters in the stream.
Parameters:
n - the number of characters to skip.

β™₯
Notifications pending to read