* For testing
* @param args
*/
public static void main(final String[] args) {
if(args.length>0){
JFrame f=new JFrame("Reading XML");
LoggingBufferPanel lp=new LoggingBufferPanel(f,"test",null);
f.getContentPane().add(lp);
final LoggingEntryByteBuffer buffer=lp.getBuffer();
try {
buffer.readXML(new File(args[0]));
} catch (ParserConfigurationException e1) {
e1.printStackTrace();
System.exit(0);
} catch (SAXException e1) {
e1.printStackTrace();
System.exit(0);
} catch (IOException e1) {
e1.printStackTrace();
System.exit(0);
}
f.addWindowListener( new WindowAdapter() {
public void windowClosing(WindowEvent e){
new TestBinary(buffer,args[0]);
}
});
f.pack();
f.show();
}
else{
JFrame f=new JFrame("Reading Binary Socket");
LoggingBufferPanel lp=new LoggingBufferPanel(f,"test",null);
f.getContentPane().add(lp);
final LoggingEntryByteBuffer buffer=lp.getBuffer();
try {
buffer.openServer(4321);
((LoggingBufferTableModel)lp.getLogbookModel()).startRefreshLoop();
} catch(IOException ie){
ie.printStackTrace();
System.exit(0);
}
Logger lr = null;
try {
SocketBufferHandler sbh=new SocketBufferHandler("localhost",4321);
lr=Logger.getLogger("TEST");
lr.addHandler(sbh);
lr.setUseParentHandlers(false);
lr.warning("Start");
} catch (IOException e) {
e.printStackTrace();
System.exit(0);
}
f.addWindowListener( new WindowAdapter() {
public void windowClosing(WindowEvent e){
try {
buffer.closeServer();
} catch (IOException e1) {
e1.printStackTrace();
System.exit(0);
}
new TestBinary(buffer,"TEST");
}
});
f.pack();
f.show();
int i=0;
while(true){
lr.info("Write "+i);
i++;