The constructor function is established to create a TXTReader object.
//The content of the test.txt file is
//"12345678901234567890
// 11111222223333344444
// 99999777777777722222"
var regFieldsDef="(.{5})(.{10})(.{5})";
var txtReader = new TXTReader("input/test.txt", regFieldsDef, "MS932");
//The content of the test.txt file is
//"123456789012345678901111122222333334444499999777777777722222"
var txtReader = new TXTReader("input/test.txt", regFieldsDef, "MS932", 20);
Calling | Returning |
new TXTReader (path, regFieldsDef) | TXTReader |
new TXTReader (path, regFieldsDef, encoding) | TXTReader |
new TXTReader (path, regFieldsDef, encoding, rowSize) | TXTReader |
new TXTReader (path, regFieldsDef, encoding, rowSize, skipRows) | TXTReader |
new TXTReader (path, regFieldsDef, encoding, rowSize, skipRows, rowsToRead) | TXTReader |
Parameters | Type | Description |
path | String | The relative file or folder path to the storage. |
regFieldsDef | String | A regular expression that defines the fields to be fetched. |
encoding | String | The charset name of the text file. The default value is UTF-8. |
rowSize | Number | The binary size of a record. The default value is -1 means undefined. |
skipRows | Number | The count of rows to be skipped without reading. The default value is -1 means undefined. |
rowsToRead | Number | The count of rows to be read. The default value is -1 means undefined. |