Ejemplo n.º 1
0
        protected override void OnOutput(BitwiseStream data)
        {
            int byteRead;

            System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
            Byte[] bytes;
            long   data_length = data.Length;

            if ((this.Iteration % Counter) == 0)
            {
                this.OnClose();
                this.setFileName(this.Iteration / Counter);
                this.OnOpen();
            }


            if (data_length == 0)
            {
                return;
            }

            while ((byteRead = data.ReadByte()) != -1)
            {
                bytes = encoding.GetBytes(byteRead.ToString("X2"));
                stream.WriteByte(bytes[0]);
                stream.WriteByte(bytes[1]);
            }

            bytes = encoding.GetBytes("\n");
            stream.WriteByte(bytes[0]);
        }
Ejemplo n.º 2
0
        protected override BitwiseStream internalEncode(BitwiseStream data)
        {
            BitStream ret    = new BitStream();
            BitWriter writer = new BitWriter(ret);
            int       b;

            while ((b = data.ReadByte()) != -1)
            {
                if ((b >= 97 && b <= 122) ||
                    (b >= 65 && b <= 90) ||
                    (b >= 48 && b <= 57) ||
                    b == 32 || b == 44 || b == 46)
                {
                    writer.WriteByte((byte)b);
                }
                else if (b <= 127)
                {
                    writer.WriteString(string.Format("\\x{0:X2}", b));
                }
                else
                {
                    //NOTE: Doing at ASCII byte level.. might not not be necesarry here as the string is not typed...
                    writer.WriteString(string.Format("\\u{0:X4}", b));
                }
            }

            ret.Seek(0, System.IO.SeekOrigin.Begin);
            return(ret);
        }
Ejemplo n.º 3
0
        protected override BitwiseStream internalEncode(BitwiseStream data)
        {
            BitStream ret = new BitStream();

            ret.WriteByte(marker);

            int value;

            while ((value = data.ReadByte()) != -1)
            {
                ret.WriteByte(shifts[value]);
            }

            ret.Seek(0, SeekOrigin.Begin);
            return(ret);
        }
Ejemplo n.º 4
0
        protected override void OnOutput(BitwiseStream data)
        {
            int byteRead;
              System.Text.ASCIIEncoding encoding= new System.Text.ASCIIEncoding();
              Byte[] bytes;
              long data_length = data.Length;

              if((this.Iteration % Counter) == 0)
            {
              this.OnClose();
              this.setFileName(this.Iteration / Counter);
              this.OnOpen();

            }

              if(data_length == 0) return;

              while((byteRead = data.ReadByte()) != -1)
            {
                      bytes = encoding.GetBytes(byteRead.ToString("X2"));
              stream.WriteByte(bytes[0]);
              stream.WriteByte(bytes[1]);
            }

              bytes = encoding.GetBytes("\n");
              stream.WriteByte(bytes[0]);
        }