Filename.st
changeset 5720 0ddf31b08b3b
parent 5642 87ad71e66acb
child 5859 68b457967cab
--- a/Filename.st	Mon Nov 20 22:13:55 2000 +0100
+++ b/Filename.st	Tue Nov 21 16:16:25 2000 +0100
@@ -1286,16 +1286,46 @@
 
 appendingWriteStream
     "return a stream for appending to the file represented by the receiver.
-     If the file does not already exist, it is created."
+     If the file does not already exist, it is created;
+     if it does exist, writes are appended at the end."
 
     ^ FileStream appendingOldFileNamed:(self osNameForAccess)
+
+    "
+     |s|
+
+     s := '/tmp/foo' asFilename writeStream.
+     s nextPutAll:'1234567890'.
+     s close.
+
+     s := '/tmp/foo' asFilename appendingWriteStream.
+     s nextPutAll:'abcdef'.
+     s close.
+
+     '/tmp/foo' asFilename contents   
+    "
 !
 
 newReadWriteStream
     "return a stream for read/write the file represented by the receiver.
-     If the file does not already exist, it is created."
+     If the file does not already exist, it is created;
+     if it does exist, it is truncated."
 
     ^ FileStream newFileNamed:(self osNameForAccess)
+
+    "
+     |s|
+
+     s := '/tmp/foo' asFilename writeStream.
+     s nextPutAll:'1234567890'.
+     s close.
+
+     s := '/tmp/foo' asFilename newReadWriteStream.
+     s nextPutAll:'12345'.
+     s close.
+
+     '/tmp/foo' asFilename contents   
+    "
 !
 
 readStream
@@ -1311,23 +1341,53 @@
 
 readWriteStream
     "return a stream for read/write the file represented by the receiver.
-     If the file does not already exist, nil is returned."
+     If the file does not already exist, nil is returned.
+     If the file does exist, it is NOT truncated."
 
     self exists ifTrue:[
         ^ FileStream oldFileNamed:(self osNameForAccess)
     ].
     ^ FileStream newFileNamed:(self osNameForAccess)
+
+    "
+     |s|
+
+     s := '/tmp/foo' asFilename writeStream.
+     s nextPutAll:'1234567890'.
+     s close.
+
+     s := '/tmp/foo' asFilename readWriteStream.
+     s nextPutAll:'abcdef'.
+     s close.
+
+     '/tmp/foo' asFilename contents      
+    "
 !
 
 writeStream
     "return a stream for writing to the file represented by the receiver.
-     If the file does not already exist, it is created."
+     If the file does not already exist, it is created;
+     if it does exist, it is truncated."
 
     ^ FileStream newFileForWritingNamed:(self osNameForAccess)
 
     "
      '/tmp/foo' asFilename writeStream 
     "
+
+    "
+     |s|
+
+     s := '/tmp/foo' asFilename writeStream.
+     s nextPutAll:'1234567890'.
+     s close.
+
+     s := '/tmp/foo' asFilename writeStream.
+     s nextPutAll:'12345'.
+     s close.
+
+     '/tmp/foo' asFilename contents  
+    "
 ! !
 
 !Filename methodsFor:'file operations'!
@@ -3730,6 +3790,6 @@
 !Filename class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.191 2000-09-28 18:34:09 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.192 2000-11-21 15:16:25 cg Exp $'
 ! !
 Filename initialize!