Skip to content

Commit

Permalink
Porting a new implementation of ZnBufferedReadWriteStream
Browse files Browse the repository at this point in the history
  • Loading branch information
tesonep committed Sep 26, 2019
1 parent a2a2b23 commit 890a365
Show file tree
Hide file tree
Showing 3 changed files with 256 additions and 78 deletions.
12 changes: 12 additions & 0 deletions src/FileSystem-Memory/MemoryFileWriteStream.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ MemoryFileWriteStream >> isBinary [
^ self stream isBinary
]

{ #category : #writing }
MemoryFileWriteStream >> next: numberOfElements putAll: aCollection startingAt: startingAt [

^ stream next: numberOfElements putAll: aCollection startingAt: startingAt
]

{ #category : #writing }
MemoryFileWriteStream >> nextPut: aCollection [
^ self stream nextPut: aCollection
Expand All @@ -61,6 +67,12 @@ MemoryFileWriteStream >> position [
^ self stream position
]

{ #category : #position }
MemoryFileWriteStream >> position: aPosition [

stream position: aPosition
]

{ #category : #positioning }
MemoryFileWriteStream >> setToEnd [
^ self stream setToEnd
Expand Down
11 changes: 7 additions & 4 deletions src/Tests/SourceFileArrayTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,13 @@ SourceFileArrayTest >> testWriteToBufferedStream [
| fs array |
fs := FileSystem memory.
array := SourceFileArray new.
array
changesFileStream: (ZnBufferedReadWriteStream on: (fs / 'changes.chunk') writeStream).
array
sourcesFileStream: (ZnBufferedReadWriteStream on: (fs / 'sources.chunk') writeStream).

array changesFileStream:
(ZnCharacterReadWriteStream on: (ZnBufferedReadWriteStream on: (fs binaryWriteStreamOn: (fs / 'changes.chunk') path)) encoding: #utf8).

array sourcesFileStream:
(ZnCharacterReadWriteStream on: (ZnBufferedReadWriteStream on: (fs binaryWriteStreamOn: (fs / 'sources.chunk') path)) encoding: #utf8).

array
writeSource: 'some source'
preamble: 'some preamble'
Expand Down
Loading

0 comments on commit 890a365

Please sign in to comment.