summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorenikey <enikey@3789f03b-4d11-0410-bbf8-ca57d06f2519>2008-12-25 11:48:13 +0000
committerenikey <enikey@3789f03b-4d11-0410-bbf8-ca57d06f2519>2008-12-25 11:48:13 +0000
commit54c1c7dac73ac5a0271534bbdb7bab05782fc2e2 (patch)
tree404e9e57e7f31d80757618561839fee4cc2e54c4
parent7716b7191859b3d6c99b4a3f18cc317c5693a6c2 (diff)
downloadtigervnc-54c1c7dac73ac5a0271534bbdb7bab05782fc2e2.tar.gz
tigervnc-54c1c7dac73ac5a0271534bbdb7bab05782fc2e2.zip
[Refactoring] RecordOutputStream use RfbProto for recording. Not using RecordInterface anymore. Removed RecordInterface methods from VncCanvas class.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3476 3789f03b-4d11-0410-bbf8-ca57d06f2519
-rw-r--r--java/src/com/tightvnc/vncviewer/RecordOutputStream.java36
-rw-r--r--java/src/com/tightvnc/vncviewer/VncCanvas.java38
2 files changed, 22 insertions, 52 deletions
diff --git a/java/src/com/tightvnc/vncviewer/RecordOutputStream.java b/java/src/com/tightvnc/vncviewer/RecordOutputStream.java
index 5b8ef1e5..3978dfc9 100644
--- a/java/src/com/tightvnc/vncviewer/RecordOutputStream.java
+++ b/java/src/com/tightvnc/vncviewer/RecordOutputStream.java
@@ -5,30 +5,34 @@ import java.io.IOException;
public class RecordOutputStream implements DataOutput {
- public RecordOutputStream(RecordInterface ri) {
- recordInterface = ri;
+ public RecordOutputStream(RfbProto rfbproto) {
+ rfb = rfbproto;
+ }
+
+ private boolean canWrite() {
+ return ((rfb != null) && (rfb.rec != null));
}
public void write(byte[] b) throws IOException {
- if (recordInterface.canWrite())
- recordInterface.write(b);
+ if (canWrite())
+ rfb.rec.write(b);
}
public void write(byte[] b, int off, int len) throws IOException {
- if (recordInterface.canWrite())
- recordInterface.write(b, off, len);
+ if (canWrite())
+ rfb.rec.write(b, off, len);
}
public void write(int b) throws IOException {
- if (recordInterface.canWrite())
- recordInterface.writeIntBE(b);
+ if (canWrite())
+ rfb.rec.writeIntBE(b);
}
public void writeBoolean(boolean v) { }
public void writeByte(int v) throws IOException {
- if (recordInterface.canWrite()) {
- recordInterface.writeByte(v);
+ if (canWrite()) {
+ rfb.rec.writeByte(v);
}
}
@@ -39,18 +43,18 @@ public class RecordOutputStream implements DataOutput {
public void writeFloat(float v) { }
public void writeInt(int v) throws IOException {
- if (recordInterface.canWrite())
- recordInterface.writeIntBE(v);
+ if (canWrite())
+ rfb.rec.writeIntBE(v);
}
public void writeLong(long v) { }
public void writeShort(int v) throws IOException {
- if (recordInterface.canWrite())
- recordInterface.writeShortBE(v);
+ if (canWrite())
+ rfb.rec.writeShortBE(v);
}
public void writeUTF(String str) { }
-
- private RecordInterface recordInterface = null;
+
+ private RfbProto rfb = null;
}
diff --git a/java/src/com/tightvnc/vncviewer/VncCanvas.java b/java/src/com/tightvnc/vncviewer/VncCanvas.java
index 21ab2ee2..59e22feb 100644
--- a/java/src/com/tightvnc/vncviewer/VncCanvas.java
+++ b/java/src/com/tightvnc/vncviewer/VncCanvas.java
@@ -45,8 +45,7 @@ import java.util.zip.*;
//
class VncCanvas extends Canvas
- implements KeyListener, MouseListener, MouseMotionListener, RecordInterface,
- Repaintable {
+ implements KeyListener, MouseListener, MouseMotionListener, Repaintable {
VncViewer viewer;
RfbProto rfb;
@@ -120,7 +119,7 @@ class VncCanvas extends Canvas
// Input stream for decoders
RfbInputStream rfbis = new RfbInputStream(rfb);
// Create output stream for session recording
- RecordOutputStream ros = new RecordOutputStream(this);
+ RecordOutputStream ros = new RecordOutputStream(rfb);
rawDecoder = new RawDecoder(memGraphics, rfbis);
rreDecoder = new RREDecoder(memGraphics, rfbis);
@@ -1273,37 +1272,4 @@ class VncCanvas extends Canvas
}
}
}
-
- //
- // Override RecordInterface methods
- //
-
- public boolean canWrite() {
- // We can record if rec is not null
- return rfb.rec != null;
- }
-
- public void write(byte b[]) throws IOException {
- rfb.rec.write(b);
- }
-
- public void write(byte b[], int off, int len) throws IOException {
- rfb.rec.write(b, off, len);
- }
-
- public void writeByte(byte b) throws IOException {
- rfb.rec.writeByte(b);
- }
-
- public void writeByte(int i) throws IOException {
- rfb.rec.writeByte(i);
- }
-
- public void writeIntBE(int v) throws IOException {
- rfb.rec.writeIntBE(v);
- }
-
- public void writeShortBE(int v) throws IOException {
- rfb.rec.writeShortBE(v);
- }
}