Push encoding specific formats into the encoders and decoders

Keep the generic stream classes clean and general.
diff --git a/common/rfb/TightDecoder.cxx b/common/rfb/TightDecoder.cxx
index 83e84f7..635df55 100644
--- a/common/rfb/TightDecoder.cxx
+++ b/common/rfb/TightDecoder.cxx
@@ -69,3 +69,22 @@
     tightDecode32(r); break;
   }
 }
+
+rdr::U32 TightDecoder::readCompact(rdr::InStream* is)
+{
+  rdr::U8 b;
+  rdr::U32 result;
+
+  b = is->readU8();
+  result = (int)b & 0x7F;
+  if (b & 0x80) {
+    b = is->readU8();
+    result |= ((int)b & 0x7F) << 7;
+    if (b & 0x80) {
+      b = is->readU8();
+      result |= ((int)b & 0xFF) << 14;
+    }
+  }
+
+  return result;
+}