1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef NET_SPDY_SPDY_PREFIXED_BUFFER_READER_H_
6 #define NET_SPDY_SPDY_PREFIXED_BUFFER_READER_H_
8 #include "net/base/net_export.h"
9 #include "net/spdy/spdy_pinnable_buffer_piece.h"
13 // Reader class which simplifies reading contiguously from
14 // from a disjoint buffer prefix & suffix.
15 class NET_EXPORT_PRIVATE SpdyPrefixedBufferReader
{
17 SpdyPrefixedBufferReader(const char* prefix
, size_t prefix_length
,
18 const char* suffix
, size_t suffix_length
);
20 // Returns number of bytes available to be read.
23 // Reads |count| bytes, copying into |*out|. Returns true on success,
24 // false if not enough bytes were available.
25 bool ReadN(size_t count
, char* out
);
27 // Reads |count| bytes, returned in |*out|. Returns true on success,
28 // false if not enough bytes were available.
29 bool ReadN(size_t count
, SpdyPinnableBufferPiece
* out
);
35 size_t prefix_length_
;
36 size_t suffix_length_
;
41 #endif // NET_SPDY_SPDY_PREFIXED_BUFFER_READER_H_