home *** CD-ROM | disk | FTP | other *** search
- package com.sfs.iavazip.viewer;
-
- import com.sfs.debug.Debug;
- import java.awt.BorderLayout;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Frame;
- import java.awt.TextArea;
- import java.io.FileNotFoundException;
- import java.io.FileReader;
- import java.io.IOException;
- import java.io.LineNumberReader;
-
- public class TxtView extends Viewer implements Runnable {
- LineNumberReader lnr;
- // $FF: renamed from: fr java.io.FileReader
- FileReader field_0;
- Thread thread;
- String fileName;
- // $FF: renamed from: ta java.awt.TextArea
- TextArea field_1;
-
- public void setArgs(Frame var1, String var2) {
- try {
- this.lnr = new LineNumberReader(this.field_0 = new FileReader(var2));
- } catch (FileNotFoundException var3) {
- Debug.Info("cannot open file \"" + var2 + "\"");
- this.lnr = null;
- return;
- }
-
- ((Container)this).setLayout(new BorderLayout());
- ((Container)this).add(this.field_1 = new TextArea());
- this.field_1.setEditable(false);
- this.field_1.setBackground(Color.white);
- this.fileName = var2;
- this.thread = new Thread(this);
- this.thread.start();
- }
-
- public void flush() {
- this.thread.stop();
- if (this.lnr != null) {
- try {
- this.lnr.close();
- this.field_0.close();
- return;
- } catch (IOException var3) {
- Debug.Info("TxtView.flush() failed during " + ((Throwable)var3).getMessage());
- }
- }
-
- }
-
- public void run() {
- try {
- String var2;
- do {
- Thread.sleep(50L);
- ((Component)this).repaint();
- int var1 = 0;
- var2 = null;
- String var3 = "";
-
- try {
- while((var2 = this.lnr.readLine()) != null) {
- var3 = var3 + var2 + System.getProperty("line.separator");
- if (var1++ == 50) {
- this.field_1.append(var3);
- break;
- }
- }
-
- if (var2 == null) {
- this.field_1.append(var3);
- }
- } catch (IOException var4) {
- this.flush();
- Debug.Info("iss was dazwischen gefunkt");
- }
- } while(var2 != null);
-
- this.flush();
- } catch (InterruptedException var5) {
- this.flush();
- }
- }
- }
-