/// <summary> /// チャンクデータ読み取り /// </summary> private void ReadChunk() { this.chunkPart = ChunkPart.Size; if (this.dechunke) { this.WriteDechunkedBody(); } }
public Chunk() { Blocks = new byte[16 * 16 * 256]; BlockMetadatas = new byte[16 * 16 * 256]; Temperatures = new byte[16 * 16]; Humidity = new byte[16 * 16]; var chunkPartsNumber = 256 / 16; ChunkParts = new ChunkPart[chunkPartsNumber]; for (int i = 0; i < chunkPartsNumber; i++) { ChunkParts[i] = new ChunkPart(); } }
/// <summary> /// チャンクサイズ読み取り /// </summary> private void ReadSize() { try { var line = Encoding.ASCII.GetString(this.line.ToArray()); // RFC7230 4.1.1 認識できないチャンク拡張は無視しなければならない var size = line.Split(new[] { ";", "\r\n" }, StringSplitOptions.None)[0]; this.chunkSize = int.Parse(size, System.Globalization.NumberStyles.HexNumber); if (this.chunkSize == 0) { this.chunkPart = ChunkPart.Trailer; return; } } catch (Exception e) { throw new InvalidChunkException("Could not read chunk-size.", e); } this.chunkPart = ChunkPart.Data; }