ConnectionInputStream: Class for reading bytes from connections

Description Usage Arguments Fields \& Methods Author(s) Examples

Description

Package: R.io
Class ConnectionInputStream

Object
~~|
~~+--InputStream
~~~~~~~|
~~~~~~~+--ConnectionInputStream

Directly known subclasses:

public static class ConnectionInputStream
extends InputStream

Class for reading bytes from connections.

Usage

1

Arguments

connection

The connection from which we want to read bytes.

...

Arguments accepted by open(); connection.

Fields \& Methods

Methods:

as.character -
available Returns the number of bytes currently available in input buffer.
close Closes the input stream and the connection.
isCloseable -
isOpen -
read Reads the next byte of data from the connection stream.
readText -

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

Author(s)

Henrik Bengtsson (http://www.braju.com/R/)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 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="")
}

con <- url("http://www.r-project.org")
fin <- ConnectionInputStream(con)

while((bfr <- read(fin, len=10)) != -1)
  printBuffer(bfr, width=10)


close(fin)



## End(Not run)

HenrikBengtsson/R.io documentation built on May 6, 2019, 11:54 p.m.