There's useful stuff here
There's advanced stuff here
new "io" (super creative)
Application
Bunch of Data
Stream
File
Application
Stream
Reading a file
Console
Application
Stream
Writing to the console
Filter to double numbers
Input: Numbers
Output: Input * 2
Stream
Stream
Stream
pipe
pipe
// value is 65.1234
double justADouble = 65.1234;
// should equal 65
int anIntTryingToBeADouble = (int) justADouble; // lossy conversion
// should be 'A'
char aCharFromAnIntFromADouble = (char) anIntTryingToBeADouble;
// value is 65.1234
double justADouble = 65.1234;
// should equal 65
int anIntTryingToBeADouble = (int) justADouble; // lossy conversion
// should be 'A'
char aCharFromAnIntFromADouble = (char) anIntTryingToBeADouble;
// should be a byte (stored in memory, typically only used for IO)
byte aByteFromACharFromAnIntFromADouble = (byte) aCharFromAnIntFromADouble;
// should be a byte (stored in memory, typically only used for IO)
byte aByteFromAnIntFromADouble = (byte) anIntTryingToBeADouble;
// value is 65.1234
double justADouble = 65.1234;
// should equal 65
int anIntTryingToBeADoubleButBeingBadAtIt = justADouble; // lossy coersion
int read();
int read( byte[] data );
void close();
void write( byte[] data );
void flush();
void close();
// open a file
File fd = new File( "/relative-or-absolute/path/to/the/file" );
// do stuff with it
fd.delete();
fd.exists();
fd.getName();
fd.getPath();
fd.length();
fd = file descriptor (i.e. some kind of abstract pointer pointing to a file)
just the variable name that is typically used
// creates a byte stream
InputStream in = new FileInputStream( fd );
// creates a character stream
InputStreamReader inReader = new InputStreamReader( in );
// creates a buffered reader
BufferedReader reader = new BufferedReader( inReader );
// creates a byte stream
OutputStream out = new FileOutputStream( fd );
// creates a character stream
OutputStreamWriter inWriter = new OutputStreamWriter( out );
// creates a buffered writer
BufferedWritter writer = new BufferedWriter( inWriter );