Try OpenEdge Now
skip to main content
ABL Reference
Class Properties and Methods Reference : Read( ) method (FileInputStream)
 

Read( ) method (FileInputStream)

This method reads data from a file input stream and stores the information in the specified MEMPTR. It returns the total number of bytes read.
Return type: INT64
Access: PUBLIC
Applies to: Progress.IO.FileInputStream class

Syntax

Read( INPUT target AS MEMPTR, INPUT offset AS INT64,
      INPUT length AS INT64 )

Read( INPUT target AS MEMPTR )
length
Indicates how many bytes the method should read from the current file input stream. The actual number of bytes read may be less than length, depending on the MEMPTR.
offset
Indicates which byte of the target MEMPTR the method should start writing to. The AVM will raise an error if this value is less than 1 or greater than the size of the MEMPTR.
target
A MEMPTR variable that the method uses to store the data it reads.

Notes

*You must initialize the MEMPTR variable before calling this method. If the MEMPTR's size is 0, the AVM will raise an error. The method will not read any data from the stream and return a value of 0.
*The method reads data from the file input stream until the MEMPTR is filled, the number of bytes specified by length is read, or the end of the stream is reached, whichever happens first.
*If the size of the MEMPTR variable was allocated outside of the AVM (in a Windows DLL or UNIX shared library, for example), you must use the SET-SIZE statement to initialize the MEMPTR before calling the Read( ) method.
*This class inherits two additional overloads of this method from File.IO.InputStream:
*Read( INPUT delimiter AS CHARACTER, OUTPUT target AS CHARACTER )
*Read( INPUT delimiter AS CHARACTER, OUTPUT target AS LONGCHAR )
*These two overloads are NOT available in Version 11.6. The methods raise an error if called.