Push encoding specific formats into the encoders and decoders

Keep the generic stream classes clean and general.
diff --git a/common/rfb/tightDecode.h b/common/rfb/tightDecode.h
index 06c8477..e139943 100644
--- a/common/rfb/tightDecode.h
+++ b/common/rfb/tightDecode.h
@@ -141,7 +141,7 @@
   if (dataSize < TIGHT_MIN_TO_COMPRESS) {
     input = is;
   } else {
-    int length = is->readCompactLength();
+    int length = readCompact(is);
     streamId = comp_ctl & 0x03;
     zis[streamId].setUnderlying(is, length);
     input = &zis[streamId];
@@ -242,7 +242,7 @@
 DECOMPRESS_JPEG_RECT(const Rect& r)
 {
   // Read length
-  int compressedLen = is->readCompactLength();
+  int compressedLen = readCompact(is);
   if (compressedLen <= 0) {
       throw Exception("Incorrect data received from the server.\n");
   }