Skip to content

Commit

Permalink
Merge pull request #4726 from tesonep/improving-speed-of-source-file
Browse files Browse the repository at this point in the history
ZnBufferedReadWriteStream should handle better the buffer.
  • Loading branch information
Ducasse committed Sep 26, 2019
2 parents dbcfdba + 5108a11 commit 82d893e
Show file tree
Hide file tree
Showing 4 changed files with 295 additions and 146 deletions.
12 changes: 12 additions & 0 deletions src/FileSystem-Memory/MemoryFileWriteStream.class.st
Expand Up @@ -49,6 +49,12 @@ MemoryFileWriteStream >> isBinary [
^ self stream isBinary
]

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

stream next: anInteger putAll: aCollection startingAt: anInteger3
]

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

{ #category : #reading }
MemoryFileWriteStream >> readInto: aCollection startingAt: anInteger count: anInteger3 [

^ stream readInto: aCollection startingAt: anInteger count: anInteger3
]

{ #category : #positioning }
MemoryFileWriteStream >> setToEnd [
^ self stream setToEnd
Expand Down
11 changes: 7 additions & 4 deletions src/Tests/SourceFileArrayTest.class.st
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

0 comments on commit 82d893e

Please sign in to comment.