GlideTextReader - Scoped

  • Release version: Washingtondc
  • Updated February 1, 2024
  • 1 minute to read
  • Provides the ability to read single lines from an input stream. Because an input stream is used, it is not subject to the 5MB attachment size limit.

    Scoped GlideTextReader - getEncoding()

    Returns the character encoding of the input stream.

    Table 1. Parameters
    Name Type Description
    None
    Table 2. Returns
    Type Description
    String The character encoding of the input stream.

    Scoped GlideTextReader - GlideTextReader( GlideScriptableInputStream inputStream)

    Creates a scoped GlideTextReader object for the specified input stream.

    Table 3. Parameters
    Name Type Description
    inputStream GlideScriptableInputStream The input stream to be read.

    Scoped GlideTextReader - readLine()

    Returns a single line from the input stream and returns a string. Since this is working off of a stream, it is not subject to the 5MB size limit.

    Table 4. Parameters
    Name Type Description
    None
    Table 5. Returns
    Type Description
    String A single line of input up to the carriage return. Does not include the carriage return. Returns null if there is no content.
    var is = new GlideSysAttachment().getContentStream(attachmentSysId);
    var reader = new GlideTextReader(is);
    var ln = ' ';
    while((ln = reader.readLine()) != null) {
      gs.info(ln);
    }