JAVA/CORBA クラス


例:IsEOS プロパティ
次のエージェントは、ストリームの終わりまでバイトのブロックを読み込んで処理します。

import lotus.domino.*;

public class JavaAgent extends AgentBase {

public void NotesMain() {

try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();

// (Your code goes here)
String inPath = "c:\\StreamFiles\\domobj.tlb";
String outPath = "c:\\StreamFiles\\domobjcopy.tlb";

// Get the input file
Stream inStream = session.createStream();
if (inStream.open(inPath, "binary")) {
if (inStream.getBytes() > 0) {
// Get the output file
Stream outStream = session.createStream();
if (outStream.open(outPath, "binary")) {
if (outStream.getBytes() == 0) {
// Transfer input file to output file
do {
byte[] buffer = inStream.read(32767);
outStream.write(buffer);
} while (!inStream.isEOS());
inStream.close();
outStream.close();
}
else
System.out.println("Output file exists and has content");
}
else
System.out.println("Output file open failed");
}
else
System.out.println("Input file has no content");
}
else
System.out.println("Input file open failed");

} catch(NotesException e) {
e.printStackTrace();

} catch(Exception e) {
e.printStackTrace();
}
}
}

関連項目