예제 #1
0
        public void Write(BeetleX.Buffers.PipeStream stream)
        {
            int len = Data.Count;

            stream.Write(len.ToString("X") + "\r\n");
            stream.Write(Data.Array, Data.Offset, Data.Count);
            stream.WriteLine("");
            if (Offset == mFileResource.Length)
            {
                stream.Write("0\r\n\r\n");
            }
        }
예제 #2
0
        public void Write(BeetleX.Buffers.PipeStream stream)
        {
            int len = Data.Count;

            stream.Write(len.ToString("X"));
            stream.Write(HeaderType.LINE_BYTES);
            stream.Write(Data.Array, Data.Offset, Data.Count);
            stream.WriteLine("");
            if (Offset == mFileResource.Length)
            {
                stream.Write(HeaderType.CHUNKED_BYTES);
            }
        }
예제 #3
0
 public void Write(BeetleX.Buffers.PipeStream stream)
 {
     if (GZip)
     {
         var mb = stream.Allocate(16);
         stream.Write(HeaderTypeFactory.LINE_BYTES);
         int len = stream.CacheLength;
         if (gZipStream == null)
         {
             gZipStream = new GZipStream(stream, CompressionMode.Compress, true);
         }
         gZipStream.Write(Data.Array, Data.Offset, Data.Count);
         gZipStream.Flush();
         if (Offset == mFileResource.Length)
         {
             if (gZipStream != null)
             {
                 using (stream.LockFree())
                 {
                     gZipStream.Dispose();
                 }
             }
         }
         string lenstr = (stream.CacheLength - len).ToString("X");
         mb.Full(Encoding.UTF8.GetBytes(lenstr.PadRight(16)));
     }
     else
     {
         int len = Data.Count;
         stream.Write(len.ToString("X"));
         stream.Write(HeaderTypeFactory.LINE_BYTES);
         stream.Write(Data.Array, Data.Offset, Data.Count);
     }
     stream.WriteLine("");
     if (Offset == mFileResource.Length)
     {
         stream.Write(HeaderTypeFactory.CHUNKED_BYTES);
     }
 }