Package com.google.cloud.examples.nio (0.126.16)

Classes

CountBytes

CountBytes will read through the whole file given as input.

This example shows how to read a file size using NIO. File.size returns the size of the file as saved in Storage metadata. This class also shows how to read all of the file's contents using NIO, computes a MD5 hash, and reports how long it took.

See the README for compilation instructions. Run this code with

target/appassembler/bin/CountBytes 

ParallelCountBytes

ParallelCountBytes will read through the whole file given as input.

This example shows how to go through all the contents of a file, in order, using multithreaded NIO reads. It prints a MD5 hash and reports how long it took.

See the README for compilation instructions. Run this code with

target/appassembler/bin/ParallelCountBytes 

Stat

Stat is a super-simple program that just displays the size of the file passed as argument.

It's meant to be used to test Google Cloud's integration with Java NIO.

You can either use the '--check' argument to see whether Google Cloud Storage is enabled, or you can directly pass in a Google Cloud Storage file name to use. In that case you have to be logged in (using e.g. the gcloud auth command).

See the README for compilation instructions. Run this code with

target/appassembler/bin/Stat --help | --check | --list | 

In short, this version (in google-cloud-examples) is in a package that lists google-cloud-nio as a dependency, so it will work directly without having to do any special work.