use of org.gridlab.gat.io.FileOutputStream in project compss by bsc-wdc.
the class FileOutputStreamExample method start.
public void start(String location) {
FileOutputStream out = null;
try {
out = GAT.createFileOutputStream(location);
} catch (GATObjectCreationException e) {
System.err.println("failed to create outputstream at location '" + location + "': " + e);
return;
}
OutputStreamWriter writer = new OutputStreamWriter(out);
try {
writer.write("Hello World!\n");
writer.flush();
} catch (IOException e) {
System.err.println("failed to write to location '" + location + "': " + e);
}
try {
writer.close();
} catch (IOException e) {
System.err.println("failed to close writer at location '" + location + "': " + e);
return;
}
}
use of org.gridlab.gat.io.FileOutputStream in project compss by bsc-wdc.
the class FileOutputStreamAdaptorTest method test.
public AdaptorTestResult test(String adaptor, String host) {
AdaptorTestResult adaptorTestResult = new AdaptorTestResult(adaptor, host);
GATContext gatContext = new GATContext();
PasswordSecurityContext password = new PasswordSecurityContext("username", "TeMpPaSsWoRd");
password.addNote("adaptors", "ftp");
gatContext.addSecurityContext(password);
// CertificateSecurityContext ctxt = new CertificateSecurityContext(null, null, "username", "passphrase");
// gatContext.addSecurityContext(ctxt);
Preferences preferences = new Preferences();
preferences.put("fileoutputstream.adaptor.name", adaptor);
FileOutputStream out = null;
try {
out = GAT.createFileOutputStream(gatContext, preferences, "any://" + host + "/JavaGAT-test-fileoutputstream");
} catch (GATObjectCreationException e) {
adaptorTestResult.put("create ", new AdaptorTestResultEntry(false, 0, e));
run(host, "fileoutputstream-adaptor-test-clean.sh");
return adaptorTestResult;
}
byte[] large = new byte[10 * 1024 * 1024];
for (int i = 0; i < large.length; i++) {
large[i] = 'a';
}
adaptorTestResult.put("write (small)", writeTest(out, "test\n"));
adaptorTestResult.put("write (large)", writeTest(out, new String(large)));
adaptorTestResult.put("flush ", flushTest(out));
adaptorTestResult.put("close ", closeTest(out));
run(host, "fileoutputstream-adaptor-test-clean.sh");
return adaptorTestResult;
}
Aggregations