for (String arg : args.getArguments())
{
CloudPath filePath = new CloudPath( arg , currentDir, CliSession.getSession( ).getCloudloop( ) );
CloudStore store = (CloudStore) filePath.getCloudProvider( );
CloudStoreFile file = store.getFile( filePath.getPath( ) );
if (!file.existsInStore( ))
{
err.println( "File '" + filePath.getPath( )
+ "' does not exist in store '"
+ store.getCloudloopToken( ) + "'." );
return 1;
}
files.add( file );
}
for (CloudStoreFile file : files)
{
// TODO: Support UTF-16 and other formats?
InputStream fileStream = file.read( null );
BufferedReader buff = new BufferedReader( new InputStreamReader(
fileStream ) );
String line;
try
{
while ( ( line = buff.readLine( ) ) != null)
{
out.println( line );
}
fileStream.close( );
} catch (IOException e)
{
err.println( "Error reading file '"
+ file.getPath( ).getAbsolutePath( ) + "' from store '"
+ file.getParentStore( ).getCloudloopToken( ) + "'." );
err.println( e.getMessage( ) );
return 1;
}
}