Browse code

explicitly close connections

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/Streamer@88792 bc3139a8-67e5-0310-9ffc-ced21a209358

Martin Morgan authored on 11/04/2014 00:03:26
Showing 5 changed files

... ...
@@ -1,7 +1,7 @@
1 1
 Package: Streamer
2 2
 Type: Package
3 3
 Title: Enabling stream processing of large files
4
-Version: 1.9.4
4
+Version: 1.9.5
5 5
 Author: Martin Morgan, Nishant Gopalakrishnan
6 6
 Maintainer: Martin Morgan <mtmorgan@fhcrc.org>
7 7
 Description: Large data files can be difficult to work with in R,
... ...
@@ -75,6 +75,7 @@ fl <- system.file(package="Rsamtools", "extdata", "ex1.sam")
75 75
 p <- ReadLinesProducer(fl, n = 1000)  # read 1000 lines at a time
76 76
 while (length(y <- yield(p)))
77 77
     print(length(y))
78
+close(p)
78 79
 
79 80
 p <- ReadTableProducer(fl, quote="", fill=TRUE, nrows=1000)
80 81
 while (length(y <- yield(p)))
... ...
@@ -112,7 +112,9 @@ rawParserFactory(separator = charToRaw("\n"), trim = separator)
112 112
 \examples{
113 113
 fl <- system.file("extdata", "s_1_sequence.txt", package="Streamer")
114 114
 b <- RawInput(fl, 100L, reader=rawReaderFactory(1e4))
115
-yield(b)
115
+length(value <- yield(b))
116
+head(value)
117
+close(b)
116 118
 }
117 119
 
118 120
 \keyword{classes}
... ...
@@ -134,6 +134,7 @@ s
134 134
 yield(s)
135 135
 reset(s)
136 136
 while (length(yield(s))) cat("tick\n")
137
+close(b)
137 138
 
138 139
 strm <- Stream(Seq(to=10), FunctionConsumer(function(y) 1/y))
139 140
 sapply(strm, c)
... ...
@@ -61,6 +61,7 @@ b <- RawInput(fl, 100L, reader=rawReaderFactory(1e4))
61 61
 s <- Stream(RawToChar(), Rev(), b)
62 62
 s
63 63
 head(yield(s)) 			# First chunk
64
+close(b)
64 65
 
65 66
 b <- RawInput(fl, 5000L, verbose=TRUE)
66 67
 d <- Downsample(sampledSize=50)
... ...
@@ -75,5 +76,6 @@ while (10 >= i && 0L != length(chunk <- yield(s)))
75 76
    cat("chunk", i, "length", length(chunk), "\n")
76 77
    i <- i + 1
77 78
 }
79
+close(b)
78 80
 }
79 81