home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: InfoMgt / InfoMgt.zip / genmb108.zip / RXFile.doc < prev    next >
Text File  |  1997-08-18  |  30KB  |  847 lines

  1. RXFile: A Rexx I/O class implementation  1.15 - Max Marsiglietti 1996.
  2.  
  3. This is the official RXFile documentation. You'll find here all the 
  4. information you need for using the RXFile library for NetRexx.
  5.  
  6. To get best results in visualization of this document, use a monospaced font.
  7. English is not my language. Please adjust your instruments accordingly. :)
  8.  
  9. INDEX:
  10.  1.... Introduction
  11.   1.1.   - What is RXFile.
  12.  
  13.  
  14.  2.... Use of the RXFile class 
  15.   2.1    - in Java.
  16.   2.2    - in NetRexx.
  17.   2.3    - A detailed explanation of all the methods.
  18.    2.3.1   - Before we begin.
  19.    2.3.2   ** RXFile constructors in NetRexx **
  20.    2.3.3   ** The STREAM method **
  21.    2.3.4   ** The CHARS method **
  22.    2.3.5   ** The LINES method **
  23.    2.3.6   ** The CHARIN method **
  24.    2.3.7   ** The LINEIN method **
  25.    2.3.8   ** The CHAROUT method **
  26.    2.3.9   ** The LINEOUT method **
  27.  
  28.    2.3.10  ** The DELETE method **
  29.    2.3.11  ** The RENAME method **
  30.    2.3.12  ** The MKDIR method **
  31.    2.3.13  ** The MKDIRS method **
  32.    2.3.14  ** The PROPERTIES method **
  33.    2.3.15  ** The FILETREE method **
  34.    2.3.16  ** The SETPARMS method **
  35.    2.3.17  ** The GETPARMS method **
  36.    2.3.18  ** The ADDCURSOR method **
  37.    2.3.19  ** The GETCURSOR method **
  38.    2.3.20  ** The DELCURSOR method **
  39.    2.3.21  ** The DELALLCURSORS method **
  40.    2.3.22  ** The ATTACHTOINPUTSTREAM method **
  41.    2.3.23  ** The ATTACHTOOUTPUTSTREAM method **
  42.    2.3.24  ** The COPY method **
  43.    2.3.25  ** The MOVE method **
  44.    2.3.26  ** The VERSION method **
  45.  
  46.  
  47.  3.... Other stuff
  48.   3.1    - This package contents.
  49.   3.2    - License.
  50.   3.3    - Contacting the author.
  51.   3.4    - Release History.
  52.  
  53.  
  54.  
  55. 1. I N T R O D U C T I O N
  56. --------------------------
  57.  
  58. Notice: NetRexx, OS/2 are copyright of IBM Corp.
  59.         JAVA is a copyright of SUN Microsystems, Inc.
  60.  
  61. Other trademarks in this document are owned by the respective companies.
  62. Whatever. :)
  63.  
  64. Warning: in this document I will assume that the reader knows
  65. what NetRexx is and how to build applications in NetRexx.
  66. JAVA I/O specific knowledge it's not required.
  67.  
  68. Many people think that JAVA is only useful for writing web applets;
  69. it is my opinion that this statement is reductive.
  70. JAVA makes a great language for a variety of purposes, expecially
  71. those requiring cross-platform development.
  72.  
  73. One of the less-explored areas of what I call 'the jungle of JAVA
  74. APIs' is the one that deals with streams and files in general.
  75. While there is in the JAVA developer's toolkit a plethora of examples
  76. to show how easy and cool is doing graphics with this language,
  77. there is not a single example specific to file usage.
  78. Not that JAVA is lacking stuff, it's only that this stuff is
  79. buried under the documentation. 
  80.  
  81. The JAVA approach approach to files and streams is somewhat confusing;
  82. there are many classes, a bunch of interfaces, and some of these
  83. apparently aren't so useful for the everyday work of Joe Programmer.
  84. That's what this package is for: helping you to manage files 
  85. and streams in Java through the use of the NetRexx compiler.
  86.  
  87.  
  88. 1.1 What is RXFile.
  89. -------------------
  90.  
  91. RXFile is a JAVA CLASS that contains a number of functions that
  92. deal with files and stdin/stdout streams.
  93.  
  94. RXFile was born to fill a gap in the NetRexx implementation;
  95. therefore, most of the methods in this class follow the syntax
  96. of the corresponding REXX statements.
  97. NetRexx is a compiler that comes as a JAVA executable and therefore
  98. can be used on every platform that has a JAVA implementation; 
  99. it produces JAVA binary code and, optionally, a JAVA source.
  100. The source language accepted by this compiler is a REXX-like 
  101. language.
  102.  
  103. NetRexx is required in order to use this class, at least the
  104. classes; download them from the URL below, and add them to
  105. your Java developing environment.
  106. All the examples are written in NetRexx, but the API syntax
  107. in this document follows the Java syntax.
  108.  
  109. To find out more, point your browser to: 
  110. http://www2.hursley.ibm.com/netrexx/
  111.  
  112.  
  113.  
  114. 2. U S E  O F  T H E  R X F I L E  C L A S S 
  115. --------------------------------------------
  116.  
  117.  
  118. 2.1 In JAVA:
  119. ------------
  120.  
  121. Just make sure that your Java environment variables
  122. knows where RXFile.class is stored, then you can just
  123. add this line to your source:
  124.  
  125. import RXFile;
  126.  
  127. along with the required NetRexx imports.
  128.  
  129.  
  130. 2.2 In NetRexx:
  131. ---------------
  132.  
  133.  import RXFile
  134.  
  135. Is required in your NetRexx source file.
  136.  
  137.  
  138.  
  139. 2.3 A detailed explanation of all the methods.
  140. ----------------------------------------------
  141.  
  142.  Why did I state 'methods', and not also 'properties' or 'exceptions' ?
  143. Simply put, the RXFile class has no public properties (variables), 
  144. and doesn't throw exceptions. Instead, it has methods to find out
  145. if there have been errors, and to query the value of some properties.
  146.  
  147.  
  148. 2.3.1 Before we begin
  149. ---------------------
  150.  
  151. The following instructions are designed to be 100% compatible with the original
  152. IBM SAA REXX implementation, so if you find any discrepancy, write to the author.
  153. (Go to the end of the document for more information)
  154.  
  155. Note: As you may know, the newline sequence is not standard among the operating
  156. systems. I.e., in Unix it's \n, in DOS-Win-OS/2 is \r\n, in Macs is \r etc.
  157. RXFile automatically sets the correct newline (currently \n, \r and \r\n are
  158. supported, since I know of these), but you can override this choice with
  159. the 'setparms' function.
  160.  
  161.  
  162. 2.3.2 ** RXFile constructors in NetRexx **
  163. ------------------------------------------
  164.  
  165. Note that the semicolon is optional:
  166.  
  167. Myfile = RXFile();
  168.  
  169. or
  170.  
  171. Myfile = RXFile("filename");
  172.  
  173. or
  174.  
  175. Myfile = RXFile(InputStream isInputStream , OutputStream osOutputStream )
  176.  
  177. This constructor assigns isInputStream, osOutputStream to the in/out
  178. streams that are normally given to console.
  179.  
  180. or
  181.  
  182. Myfile = RXFile("filename", "c", "command");
  183.  
  184. The above constructor works as in the STREAM method.
  185.  
  186. The default return strings for the following functions are: 
  187.  SYNTAX ERROR:
  188.  READY:       (no errors)
  189.  NOTREADY:32  (file in use)
  190.  NOTREADY:110 (file not found)
  191.  NOTREADY:EOF (end of file reached)
  192.  WEIRD ERROR: (this is a catch for bugs)
  193.  NOFILEOPEN:  (if the user requested an operation to be done only on open files)
  194.  ILLEGAL:WRONG ACCESS MODE (i.e. if you try to read a write-only file)
  195.  ILLEGAL:ALREADY EXISTS    (if the command implied creation of something)
  196.  ILLEGAL:CANT ACCESS TARGET
  197.  ILLEGAL:ALREADY INIT       (used for the setparms command)
  198.  
  199. Unless stated otherwise.
  200.  
  201.  
  202. 2.3.3 ** The STREAM method **
  203. -----------------------------
  204.  
  205. Used to open/close a file, query information about that file 
  206. and/or status, and seek the file cursor to a given location.
  207.  
  208. Rexx status = RXFile.stream(Rexx filename, "c", Rexx command);
  209. Rexx status = RXFile.stream("c", Rexx command);
  210. Rexx status = RXFile.stream("d");
  211. Rexx status = RXFile.stream("s");
  212.  
  213. More in details:
  214.  
  215.  
  216. Rexx status = RXFile.stream(Rexx filename, "c", Rexx command);
  217.  
  218. The commands available are:
  219. "open"           opens a file for read and write operations.
  220. "open read"      opens a file for read operations.
  221. "open write"     opens a file for write operations.
  222. "query exists"   returns the absolute path name, or the null string if
  223.                  that file doesn't exists.
  224. "query size"     returns the size, in bytes, of the file.
  225. "query datetime" returns a value useful for file comparisons (it
  226.                   doesn't return a REAL date & time, due to the
  227.                   lack of such an API in JAVA).
  228. "close"          closes the stream.
  229.  
  230. Warning: if you issue one of the next three commands when you
  231. are in 'separate r/w cursors' mode, you actually move both cursors.
  232.  
  233. Warning 2: In REXX, the first byte of the stream is at position '1', not
  234. '0' like Java. Therefore, if you do an absolute seek ('=N'), you should
  235. remember that to seek the first byte in the stream you have to
  236. issue "seek =1". All the other seek instructions are relative, so you
  237. can specify an offset = 0.
  238.  
  239. "seek =N"        The stream cursor is positioned to absolute position N 
  240.                  (in bytes; an ASCII newline is \r\n == two bytes).
  241. "seek -N"        The stream cursor is positioned N bytes back from the
  242.                  current position.
  243. "seek +N"        The stream cursor is positioned N bytes forward from the
  244.                  current position.
  245. "seek <N"        The stream cursor is positioned N bytes back from the
  246.                  end of the file.
  247.  
  248. Functions available only if you choose separate r/w cursors: 
  249. (see the SETPARMS function)
  250.  
  251. "rseek =N"        The stream read cursor is positioned to absolute position N 
  252.                  (in bytes; an ASCII newline is \r\n == two bytes).
  253. "rseek -N"        The stream read cursor is positioned N bytes back from the
  254.                  current position.
  255. "rseek +N"        The stream read cursor is positioned N bytes forward from the
  256.                  current position.
  257. "rseek <N"        The stream read cursor is positioned N bytes back from the
  258.                  end of the file.
  259. "wseek =N"        The stream write cursor is positioned to absolute position N 
  260.                  (in bytes; an ASCII newline is \r\n == two bytes).
  261. "wseek -N"        The stream write cursor is positioned N bytes back from the
  262.                  current position.
  263. "wseek +N"        The stream write cursor is positioned N bytes forward from the
  264.                  current position.
  265. "wseek <N"        The stream write cursor is positioned N bytes back from the
  266.                  end of the file.
  267.  
  268. Rexx status = RXFile.stream("c", Rexx command);
  269.  
  270. This command can be issued only when a file 
  271. has already been opened by executing a .stream call.
  272.  
  273. The commands available are:
  274. "close"          closes the stream.
  275. "query exists"   returns the absolute path name, or the null string.
  276. "query size"     returns the size, in bytes, of the file.
  277. "query datetime" returns a value useful for file comparisons (it
  278.                   doesn't return a REAL date & time, due to the
  279.                   lack of such an API in JAVA).
  280.  
  281. Warning: if you issue one of the next three commands when you
  282. are in 'separate r/w cursors' mode, you actually move both cursors.
  283.  
  284. Warning 2: In REXX, the first byte of the stream is at position '1', not
  285. '0' like Java. Therefore, if you do an absolute seek ('=N'), you should
  286. remember that to seek the first byte in the stream you have to
  287. issue "seek =1". All the other seek instructions are relative, so you
  288. can specify an offset = 0.
  289.  
  290. "seek =N"        The stream cursor is positioned to absolute position N 
  291.                  (in bytes; an ASCII newline is \r\n == two bytes).
  292. "seek -N"        The stream cursor is positioned N bytes back from the
  293.                  current position.
  294. "seek +N"        The stream cursor is positioned N bytes forward from the
  295.                  current position.
  296. "seek <N"        The stream cursor is positioned N bytes back from the
  297.                  end of the file.
  298.  
  299. Functions available only if you choose separate r/w cursors: 
  300. (see the SETPARMS function)
  301.  
  302. "rseek =N"        The stream read cursor is positioned to absolute position N 
  303.                  (in bytes; an ASCII newline is \r\n == two bytes).
  304. "rseek -N"        The stream read cursor is positioned N bytes back from the
  305.                  current position.
  306. "rseek +N"        The stream read cursor is positioned N bytes forward from the
  307.                  current position.
  308. "rseek <N"        The stream read cursor is positioned N bytes back from the
  309.                  end of the file.
  310. "wseek =N"        The stream write cursor is positioned to absolute position N 
  311.                  (in bytes; an ASCII newline is \r\n == two bytes).
  312. "wseek -N"        The stream write cursor is positioned N bytes back from the
  313.                  current position.
  314. "wseek +N"        The stream write cursor is positioned N bytes forward from the
  315.                  current position.
  316. "wseek <N"        The stream write cursor is positioned N bytes back from the
  317.                  end of the file.
  318.  
  319.  
  320. Rexx status = RXFile.stream("d");
  321. Rexx status = RXFile.stream("s");
  322.  
  323. Both these commands return the status of the stream.
  324. (they can be issued only when a file has already been opened by
  325. executing a .stream call)
  326.  
  327. The difference between them is that the latter form is more terse,
  328. the former is more verbose.
  329.  
  330.  
  331. 2.3.4 ** The CHARS method **
  332. ----------------------------
  333.  
  334. Rexx RXFile.chars();
  335. Rexx RXFile.chars(Rexx rFileName);
  336.  
  337. This method lets you know if there are, and how many are they, 
  338. characters to be read in a stream or standard input.
  339.  
  340. More in details:
  341.  
  342. Rexx RXFile.chars();
  343.  
  344. This method returns how many bytes are present in the
  345. currently opened stream. If no stream is currently open,
  346. it returns with the number of the available bytes from
  347. stdin (Warning: this doesn't work right now for stdin; 
  348. it always returns '0').
  349.  
  350. Rexx RXFile.chars(Rexx rFileName);
  351.  
  352. *This method works with files only, no standard input.*
  353.  
  354. This method returns how many bytes are present in the
  355. file rFileName.
  356. rFileName is opened with both read and write access 
  357. permissions, and a precedently open file, if exists, is closed.
  358.  
  359. Of course, if the file name is the same of the one which is
  360. (if any) currently in use, the file won't be touched, meaning
  361. that the r/w cursors will be left untouched.
  362.  
  363. The only exception is the following: if you opened rFileName 
  364. precedently with only read OR write permissions, the file will be
  365. closed and then reopened with read+write permissions.
  366. This is because lines(filename) opens the file with both read
  367. and write access capabilities.
  368.  
  369. After this operation, the currently opened file is rFileName.
  370.  
  371.  
  372. 2.3.5 ** The LINES method **
  373. ----------------------------
  374.  
  375. Rexx RXFile.lines();
  376. Rexx RXFile.lines(Rexx rFileName);
  377.  
  378. This method lets you know if there are still lines to be read
  379. in a stream or standard input.
  380.  
  381. More in details:
  382.  
  383. Rexx RXFile.lines();
  384.  
  385. This method returns "1" if there are more lines to be read 
  386. (or overwritten) in the file currently in use, else it returns "0" .
  387. If no stream is opened, it checks for the presence of lines
  388. to be read in stdin .
  389.  
  390. Rexx RXFile.lines(Rexx rFileName);
  391.  
  392. *This method works with files only, no standard input.*
  393.  
  394. This method returns "1" if there are more lines to be read 
  395. (or overwritten) in the file rFileName, else it returns "0" .
  396. rFileName is opened with both read and write access permissions, 
  397. and a precedently open file, if exists, is closed.
  398.  
  399. Of course, if the file name is the same of the one which is
  400. (if any) currently in use, the file won't be touched, meaning
  401. that the r/w cursors will be left untouched.
  402.  
  403. The only exception is the following: if you opened rFileName 
  404. precedently with only read OR write permissions, the file will be
  405. closed and then reopened with read+write permissions.
  406. This is because linein(filename) opens the file with both read
  407. and write access capabilities.
  408.  
  409. After this operation, the currently opened file is rFileName.
  410.  
  411.  
  412. 2.3.6 ** The CHARIN method **
  413. -----------------------------
  414.  
  415. Rexx RXFile.charin();
  416. Rexx RXFile.charin(Rexx rFileName);
  417. Rexx RXFile.charin(long lStartPos, int iHowManyBytes);
  418. Rexx RXFile.charin(Rexx rFileName, long lStartPos, int iHowManyBytes);
  419.  
  420. This method gets one or more bytes from the standard input or
  421. a currently opened stream.
  422.  
  423. The methods which include also rFileName allow to close the currently opened
  424. stream and open the new one before actually doing the work without issueing
  425. a separate .stream command. These methods default to read AND write
  426. capabilities.
  427.  
  428. More in details:
  429.  
  430. Rexx RXFile.charin();
  431.  
  432. Returns the next byte from the currently used stream.
  433. If no stream is currently open, it returns the next byte
  434. from the standard input.
  435.  
  436. Rexx RXFile.charin(long lStartPos, int iHowManyBytes);
  437.  
  438. *This method works with files only, no standard input.*
  439.  
  440. Returns lHowManyBytes, starting from the absolute position lStartPos.
  441. If you specify a value of 0 (zero) for lStartPos, the bytes after
  442. the current cursor position in the stream will be read.
  443. (The first character in the stream is numbered 1)
  444.  
  445.  
  446. 2.3.7 ** The LINEIN method **
  447. -----------------------------
  448.  
  449. Rexx RXFile.linein();
  450. Rexx RXFile.linein(Rexx rFileName);
  451. Rexx RXFile.linein(int iLine, int iCount);
  452. Rexx RXFile.linein(Rexx rFileName, int iLine, int iCount);
  453.  
  454. This method returns zero or one lines of **ASCII** characters
  455. from the standard input or the stream in use.
  456.  
  457. The methods which include also rFileName allow to close the currently opened
  458. stream and open the new one before actually doing the work without issueing
  459. a separate .stream method. These methods default to read AND write
  460. capabilities.
  461.  
  462. More in details:
  463.  
  464. Rexx RXFile.linein();
  465.  
  466. Returns the next line from a stream, or from the stdin if no stream
  467. is currently open.
  468.  
  469. Rexx RXFile.linein(int iLine, int iCount);
  470.  
  471. *This method works with files only, no standard input.*
  472.  
  473. Returns iCount lines (where iCount can be only zero or one) from
  474. the currently in use stream, starting from position iLine
  475. where iLine can be zero (read the next line), or one (read the
  476. first line of the stream).
  477. Why to get zero lines? Because this way we have an alternative way
  478. to position the cursor at the beginning of the file.
  479.  
  480. Rexx RXFile.linein(Rexx rFileName);
  481.  
  482. *This method works with files only, no standard input.*
  483.  
  484. Returns the first line from stream rFileName (thus opening it with both read
  485. and write access permissions, as well as closing a precedently open file if any).
  486. After this operation, the currently opened file is rFileName.
  487.  
  488.  
  489. 2.3.8 ** The CHAROUT method **
  490. ------------------------------
  491.  
  492. Rexx RXFile.charout(Rexx rToWrite);
  493. Rexx RXFile.charout(Rexx rToWrite, long lStartPos);
  494. Rexx RXFile.charout(Rexx rFileName, Rexx rToWrite);
  495. Rexx RXFile.charout(Rexx rFileName, Rexx rToWrite, long lStartPos);
  496.  
  497. This method is used to write a string on a stream, or on stdout.
  498.  
  499. The latter two syntaxes allow to start working on a new file without issueing
  500. a separate stream method.
  501.  
  502. More in details:
  503.  
  504. Rexx RXFile.charout(Rexx rToWrite);
  505.  
  506. Writes the Rexx string rToWrite to the currently opened stream, at the
  507. current cursor position. If no stream is in use, the string is
  508. put on stdout (usually the screen).
  509.  
  510. Rexx RXFile.charout(Rexx rToWrite, long lStartPos);
  511.  
  512. *This method works with files only, no standard input.*
  513.  
  514. This version of the method also allows to specify an absolute
  515. starting position for the write on the stream. If lStartPos
  516. is equal to zero, then the write will occur at the current
  517. cursor position in the stream.
  518.  
  519.  
  520. 2.3.9 ** The LINEOUT method **
  521. ------------------------------
  522.  
  523. Rexx RXFile.lineout(Rexx rToWrite);
  524. Rexx RXFile.lineout(Rexx rToWrite, long lStartPos);
  525. Rexx RXFile.lineout(Rexx rFileName, Rexx rToWrite);
  526. Rexx RXFile.lineout(Rexx rFileName, Rexx rToWrite, long lStartPos);
  527.  
  528. This method is used to write a string adding a CR+LF (\r\n)
  529. or a LF (\n) (depending on how/if you called SETPARMS) on a stream, 
  530. or on stdout.
  531.  
  532. The latter two syntaxes allow to start working on a new file without issueing
  533. a separate stream method.
  534.  
  535. More in details:
  536.  
  537. Rexx RXFile.lineout(Rexx rToWrite);
  538.  
  539. Writes the Rexx string rToWrite to the currently opened stream, at the
  540. current cursor position, and adds a CR+LF or LF at the end of it.
  541. If no stream is in use, the string is put on stdout (usually the screen).
  542.  
  543. Rexx RXFile.lineout(Rexx rToWrite, long lStartPos);
  544.  
  545. *This method works with files only, no standard input.*
  546.  
  547. This version of the method also allows to specify an absolute
  548. starting position for the write on the stream. If lStartPos
  549. is equal to zero, then the write will occur at the current
  550. cursor position in the stream. 
  551. Please note that lStartPos can only be assigned the values zero or one,
  552. one meaning "write at the beginning of the file" and zero meaning
  553. "write at the current cursor position in the stream".
  554.  
  555.  
  556. The next methods are not ported from REXX. However, since they are
  557. very useful when dealing with I/O procedures, I have included them
  558. in the RXFile package.
  559.  
  560.  
  561. 2.3.10 ** The DELETE method **
  562. ------------------------------
  563.  
  564. Rexx RXFile.delete(Rexx FileName);
  565.  
  566. This method deletes a file.
  567.  
  568.  
  569. 2.3.11 ** The RENAME method **
  570. ------------------------------
  571.  
  572. Rexx RXFile.rename(Rexx OldFileName, Rexx NewFileName);
  573.  
  574. This method renames OldFileName into NewFileName.
  575.  
  576.  
  577. 2.3.12 ** The MKDIR method **
  578. -----------------------------
  579.  
  580. Rexx RXFile.mkdir(Rexx DirName);
  581.  
  582. Creates the directory DirName.
  583.  
  584.  
  585. 2.3.13 ** The MKDIRS method **
  586. ------------------------------
  587.  
  588. Rexx RXFile.mkdirs(Rexx DirName);
  589.  
  590. Creates the directory that comes last in DirName, 
  591. and all the preceding directories if they are not present.
  592.  
  593. i.e. if you have DirName set to "/usr/max/I/LOVE/WARP/CONNECT",
  594. and you don't have the directories I, LOVE, WARP and CONNECT, but
  595. you have usr and max, this function will create all of the ones that
  596. are not there, where mkdir would have failed since to create CONNECT
  597. you had to have all of usr, max, I, LOVE, WARP already created.
  598.  
  599. YMMV. This is the one API I have never tested. :)
  600.  
  601.  
  602. 2.3.14 ** The PROPERTIES method **
  603. ----------------------------------
  604.  
  605. Rexx RXFile.properties(Rexx FileName);
  606.  
  607. Returns the properties of the specified file or directory.
  608.  
  609. Properties:
  610.  
  611. The returned string is a four character string; every character
  612. can be '-' if the property is not valid for FileName or:
  613.  
  614.  f if the specified FileName refers to a file.
  615.  d if the specified FileName refers to a directory.
  616.  w if the specified FileName is writable.
  617.  r if the specified FileName is readable.
  618.  
  619. Example: 'f-wr' means that FileName is a file and we have both
  620. read and write permissions for it.
  621.  
  622.  
  623. 2.3.15 ** The FILETREE method **
  624. --------------------------------
  625.  
  626. Rexx[] RXFile.filetree(Rexx DirName);
  627.  
  628. This method returns all the file names for the specified directory.
  629. If the directory name is invalid (if there is not such a directory)
  630. you will get the "NOTREADY:NOSUCHDIRECTORY" error as the first and
  631. unique element of the returned array.
  632. If the directory is empty you will get "NOTREADY:DIRECTORYISEMPTY".
  633.  
  634.  
  635. 2.3.16 ** The SETPARMS method **
  636. --------------------------------
  637.  
  638. Rexx RXFile.setparms(boolean bSepCurs, boolean bRN);
  639.  
  640. This method, to be issued before opening any file (but only if
  641. needed), is used to define some RXFile options.
  642.  
  643. When bSepCurs is 1, you have two distinct cursors, one for read
  644. and one for write. Otherwise, you only have one cursor (this is
  645. the default, and it's also the way OS/2 REXX works).
  646.  
  647. When bRN is 1, the character used to do a newline is \r\n (dec 13 10);
  648. when this parameter is set to zero, the newline is only \n .
  649. This property is set upon RXFile variable's instantiation to follow
  650. whatever is the system's default
  651.  
  652.  
  653. 2.3.17 ** The GETPARMS method **
  654. --------------------------------
  655.  
  656. Rexx RXFile.getparms();
  657.  
  658. This method is used to retrieve the status of some RXFile options.
  659.  
  660. It returns a Rexx string which is composed of two binary digits, ie "11".
  661.  
  662. When the first is 1, you have two distinct cursors, one for read
  663. and one for write. Otherwise, you only have one cursor (this is
  664. the default, and it's also the way OS/2 REXX works).
  665.  
  666. When the second is 1, the character used to do a newline is 
  667. \r\n (dec 13 10); when this parameter is set to zero, 
  668. the newline is only \n . This property is set upon instantiation to follow
  669. whatever is the system's default, but can be changed with the SETPARMS method.
  670.  
  671.  
  672. 2.3.18  ** The ADDCURSOR method **
  673. ----------------------------------
  674.  
  675. Rexx RXFile.addcursor(Rexx rKey, long lCursPos);
  676.  
  677. This method stores (into the variable's memory, which is unique for every
  678. RXFile instance) the lCursPos cursor position, under the name rKey. 
  679. You can retrieve this information later, with getcursor, or delete it with 
  680. delcursor or delallcursors.
  681.  
  682. This is useful when you have to work on many points of a file.
  683.  
  684.  
  685. 2.3.19  ** The GETCURSOR method **
  686. ----------------------------------
  687.  
  688. Rexx RXFile.getcursor(Rexx rKey);
  689.  
  690. This method retrieve (from the variable's memory, which is unique for every
  691. RXFile instance) the cursor position which has been stored under the name rKey. 
  692. If you request a cursor position that hasn't been stored, you'll get the message
  693. "Error: no such cursor." instead of a Rexx string representing a long.
  694.  
  695.  
  696. 2.3.20  ** The DELCURSOR method **
  697. ----------------------------------
  698.  
  699. Rexx RXFile.delcursor(Rexx rKey);
  700.  
  701. This method deletes (from the variable's memory, which is unique for every
  702. RXFile instance) the cursor position which has been stored under the name rKey. 
  703.  
  704.  
  705. 2.3.21  ** The DELALLCURSORS method **
  706. --------------------------------------
  707.  
  708. Rexx RXFile.delallcursors();
  709.  
  710. This method deletes (from the variable's memory, which is unique for every
  711. RXFile instance) all of the cursor positions which have been stored. 
  712.  
  713.  
  714. 2.3.22  ** The ATTACHTOINPUTSTREAM method **
  715. --------------------------------------------
  716.  
  717. Rexx RXFile.attachtoinputstream(InputStream is)
  718.  
  719. This method redirects the InputStream 'is' to the default InputStream for that
  720. RXFile instance (i.e. replacing user input from console). You didn't know
  721. that RXFile had an InputStream, or you didn't find notice of this fact anywhere?
  722. That's because it's a private property. Now you can interact with it this way.
  723.  
  724.  
  725. 2.3.23  ** The ATTACHTOOUTPUTSTREAM method **
  726. ---------------------------------------------
  727.  
  728. Rexx RXFile.attachtooutputstream(OutputStream os)
  729.  
  730. This method redirects the OutputStream 'os' to the default OutputStream for that
  731. RXFile instance (i.e. replacing console output).
  732.  
  733.  
  734. 2.3.24 ** The COPY method **
  735. ------------------------------
  736.  
  737. Rexx RXFile.copy(Rexx SourceFileName, Rexx TargetFileName);
  738.  
  739. This method copies SourceFileName into TargetFileName (overwriting it if necessary).
  740.  
  741.  
  742.  
  743. 2.3.25 ** The MOVE method **
  744. ----------------------------
  745.  
  746. Rexx RXFile.move(Rexx SourceFileName, Rexx TargetFileName);
  747.  
  748. This method moves SourceFileName into TargetFileName (overwriting it if necessary).
  749. Note: It *can* move files from a drive to another drive.
  750.  
  751.  
  752.  
  753. 2.3.26 ** The VERSION method **
  754. -------------------------------
  755.  
  756. Rexx version();
  757.  
  758. This method returns version information, like in:
  759.  
  760. RXFile 1.15, @ Copyright Max Marsiglietti 1996, 97
  761.  
  762.  
  763.  
  764.  
  765. 3. O T H E R   S T U F F
  766. ------------------------
  767.  
  768.  
  769.  
  770. 3.1 THIS PACKAGE CONTENTS
  771. -------------------------
  772.  
  773. This package should contain:
  774.  
  775.  RXFile.doc   .. this document.
  776.  guru.doc     .. working code to use in your programs.
  777.  RXFile.class .. the RXFile class for NetRexx (and Java).
  778.  *.nrx ..  => Examples for the RXFile class.
  779.  *.cmd ..   => Examples for the RXFile class (REXX files).
  780.  
  781.  
  782.  
  783. 3.2 LICENSE
  784. ------------
  785.  
  786. RXFile is not public domain: it is freeware. It means that you can freely
  787. use it in your programs, be them for personal use and/or commercial use.
  788. However, the sources are not provided, and you cannot modify or disassemble
  789. the class, in any way. Also, if you re-distribute this program, you cannot
  790. charge any money for it, apart from media costs (eg. diskette cost).
  791. If you plan to use this class on a project of yours, you must give credits
  792. to the author (Max Marsiglietti) of this.
  793.  
  794. I am not responsible or liable in any way for damages 
  795. deriving from the use of this product. Use it at your own risk.
  796.  
  797.  
  798. 3.3 CONTACTING THE AUTHOR
  799. -------------------------
  800.  
  801. This library is intended to follow more closely possible the REXX language I/O
  802. functions. If you find any discrepancy from them, or bugs, please report all
  803. of your comments to:
  804.  
  805.  Max Marsiglietti, 
  806.  
  807.  E-mail:
  808.   maxmars@pianeta.it (Internet), 2:332/529.12 (Fidonet)
  809.  
  810.  Snail Mail:
  811.   V.Landino 13, 
  812.   41049, Sassuolo (MO)
  813.   Italy.
  814.  
  815.  
  816.  
  817. 3.4 History
  818. -----------
  819.  
  820. 1.15 .. (18-aug-97) Corrected behaviour of some methods to
  821.         let RXFile work well under Win32.
  822. 1.14 .. (21-jun-97) Added the MOVE and VERSION methods,
  823.         speeded up some other methods.
  824. 1.13 .. (08-may-97) Fixed the behaviour of linein:
  825.          an EOF now correctly reports EOF instead of
  826.          throwing a NullPointerException exception.
  827. 1.12 .. (19-apr-97) Fixed a bug, added the COPY method.
  828. 1.11 .. (13-feb-97) Fixed a bug in mkdirs.
  829. 1.10 .. (19-dec-96) Added support for Mac line termination (\r).
  830. 1.09 .. (03-dec-96) Fixed a bug in filetree, added new return 
  831.         codes for that function.
  832. 1.08 .. (12-nov-96) Fixed a problem with lineout console output,
  833.         added redirected in/out capabilities (attachtoinputstream
  834.         and attachtooutputstream). Reworked a bit some internals.
  835. 1.07 .. Internal changes, for synchronization with RXDbase.
  836. 1.06 .. Fixed the 'rename' function.
  837. 1.05 .. Now linein should work with both \r\n and \n terminated ASCII
  838.         files, independently from the platform.
  839. 1.04 .. Fixed strange behaviour of linein. Compiled with NetRexx 0.81.
  840. 1.03 .. Bug fixes to the docs and internal changes for RXDbase.
  841. 1.02 .. Bug fixes to stream and lineout. Works with NetRexx 0.79.
  842. 1.01 .. Added a cursor stack: addcursor, getcursor, delcursor,
  843.                               delallcursors functions added.
  844. 1.00 .. First implementation of RXFile.
  845.  
  846. Thanks, and good work with RXFile!
  847.