James Sherry PRO
Web Development Tutor and Co-Founder of { The Jump } Digital School
(Blame marketing d*cks!)
import from java.io.File;
import from com.lowagie.text.Document;
public static void fileCopy( File in, File out )
throws IOException
{
FileChannel inChannel = new FileInputStream( in ).getChannel();
FileChannel outChannel = new FileOutputStream( out ).getChannel();
try
{
// magic number for Windows, 64Mb - 32Kb)
int maxCount = (64 * 1024 * 1024) - (32 * 1024);
long size = inChannel.size();
long position = 0;
while ( position < size )
{
position += inChannel.transferTo( position, maxCount, outChannel );
}
}
finally
{
if ( inChannel != null )
{
inChannel.close();
}
if ( outChannel != null )
{
outChannel.close();
}
}
}
Look out for:
Javascript is:
C program (like browser) talks to OS (also in C, so direct conversation) => "Reserve me some space on the RAM chips (or HD) for this value"
Javascript is interpreted into C code and then that code is run on the C layer =>
C layer reserves memory on javascript's behalf.
(Javascript has no direct access)
Every feature in JavaScript is the result of someone writing some C code and labelling it with a name that is then used when you type it in the JavaScript
In short, in every case, <some ACTUAL programming language> sets up a way to read written javascript text and turn it into the code OF THAT LANGUAGE. So for javascript to do anything it requires runtime AND an interface.
Browsers: v8 engine & DOM interface
Servers: Node.js (both)
IOT:<some runtime> & <some interface>
So, some programming to run it and some to let it control things.
So JavaScript was born to control the interface between Browsers and Servers
DEV TOOLS:
Good demo, but this (like the Node command line) is only an emulation! It is not bullet-proof!
INSTALLFEST COMMENCE!!
By James Sherry
Intro to JS Course