home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rio111.zip / RXFile.doc < prev    next >
Text File  |  1997-02-13  |  29KB  |  808 lines

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