/**
* @(#)StreamAnalyser.java
* Copyright: Copyright (c) 2007
* Company:
* @author Mario Lausberg
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*
*/
package org.tn5250j;
import org.tn5250j.event.ScreenListener;
import org.tn5250j.framework.tn5250.Screen5250;
import org.tn5250j.framework.tn5250.tnvt;
/**
* A host GUI session
*/
public class StreamAnalyser implements TN5250jConstants {
private Screen5250 screen;
private tnvt analyser;
/**
* Main Class to analyse a 5250Buffer
* You put in a 5250 Buffer and get a Screen5250-Object. You can add your own Listeners to this
* Screen Object and work with this Screen Object.
* For example an aid key sended to this ScreenObject will trigger to fill the outputBuffer.
* You get the OutputBuffer with the Methode getDataResponseStream
*/
public StreamAnalyser(ScreenListener listener) {
if(analyser == null){
analyser = new tnvt();
}
screen = analyser.getScreen();
listener.setScreen(screen);
screen.getOIA().addOIAListener(listener);
screen.addScreenListener(listener);
}
/**
* @param dataInputStream
* @return true if tn5250 connection is still in use
*/
public boolean process(byte[] dataInputStream) {
return analyser.startAnalysingStream(dataInputStream);
}
public boolean isActive(){
return analyser.isConnected();
}
public byte[] getDataResponseStream(){
return analyser.getOutBuffer();
}
}