method readStringOfLength

string readStringOfLength(int32 length,string encoding);


Zurückgegebener Wert

This method reads a string of a given length of bytes (not chars) and advance the stream's position. If the stream does not contain enough data for an atomic read, then the read will fail and the stream's position is unaffected. The returned string is treated as if it is encoded by the encoding type passed in.
var fileStreamObj = shell.serviceManager.basics.fileStream;
var streamReaderObj = shell.serviceManager.basics.rawStreamReader;

//test.txt file must be created by using rawStreamWriter
//for proper read back
fileStreamObj.openForRead("c:\\temp\\test.txt"); = fileStreamObj;
var firstValue = streamReaderObj.readStringOfLength(4, "");
var secondValue = streamReaderObj.readStringOfLength(4, "");