| Stream |
|
typedict |
| |
A variable that is declared to be a
Stream
accepts any I/O stream value, namely
File,
StringStream,
or
URL,
and its type corresponds to the type of that value.
Uninitialized
Stream
variables, no matter where they happen to be declared, always start as
NULL.
| |
| Example: |
The program,
import yoix.*.*;
Stream s1;
Stream s2 = new File { String name = "filename"; };
Stream s3 = new StringStream { String name = "content"; };
Stream s4 = new URL { String name = "http://www.att.com/"; };
type(e) {
if (e == NULL)
return(toString(e));
else if (isFile(e))
return("File");
else if (isStringStream(e))
return("StringStream");
else if (isURL(e))
return("URL");
return("ERROR!");
}
printf("s1=%s, s2=%s, s3=%s, s4=%s\n",
type(s1), type(s2), type(s3), type(s4));
s1 = s2;
s2 = s3;
s3 = s4;
s4 = NULL;
printf("s1=%s, s2=%s, s3=%s, s4=%s\n",
type(s1), type(s2), type(s3), type(s4));
prints
s1=NULL:Stream, s2=File, s3=StringStream, s4=URL
s1=File, s2=StringStream, s3=URL, s4=NULL:Stream
on standard output.
| | |
| See Also: |
close,
File,
fopen,
open,
read,
readChar,
readLine,
readStream,
StringStream,
URL,
write,
writeChar,
writeLine,
ZipEntry
|
|
Yoix is a registered trademark of AT&T Intellectual Property.
|