Description Usage Arguments Fields and Methods Author(s) Examples
Package: R.io
Class FileInputStream
Object
~~|
~~+--
InputStream
~~~~~~~|
~~~~~~~+--
FileInputStream
Directly known subclasses:
public static class FileInputStream
extends InputStream
Class for reading bytes from a file.
1 |
file |
A filename string or a |
Methods:
available | Returns the number of bytes currently available in input buffer. | |
close | Closes the input stream and releases the file. | |
read | Reads the next byte of data from the file input stream. | |
Methods inherited from InputStream:
available, close, finalize, mark, markSupported, read, reset, skip
Methods inherited from Object:
$, $<-, [[, [[<-, as.character, attach, attachLocally, clearCache, clone, detach, equals, extend, finalize, gc, getEnvironment, getFields, getInstanciationTime, getStaticInstance, hasField, hashCode, ll, load, objectSize, print, save
Henrik Bengtsson (http://www.braju.com/R/)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | path <- Package("R.io")$path
file <- file.path(path, "DESCRIPTION")
# Using a File object would also work
# file <- File(path, "DESCRIPTION")
fin <- FileInputStream(file)
printBuffer <- function(bfr, width=10) {
s1 <- paste(formatC(bfr, digits=3), collapse=",", sep="")
s1 <- formatC(s1, width=5*width, flag="-");
bfr[is.element(bfr, 0:31)] <- 46; # "."
s2 <- paste(intToChar(bfr), collapse="")
cat(s1, " ", s2, "\n", sep="")
}
while((bfr <- read(fin, len=10)) != -1)
printBuffer(bfr, width=10)
close(fin)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.