@@ -46,46 +46,40 @@ Blob::Dump()
4646hexdump (data + begin, length);
4747}
4848
49+
4950std::shared_ptr<Blob>
50- Blob::ShiftBytes (size_t n )
51+ Blob::Chop (size_t chop_size )
5152{
52- if (this ->Size () <n )
53+ if (this ->Size () <chop_size )
5354 {
5455throw OutOfData ();
5556 }
5657
57- std::shared_ptr<Blob> new_blob = std::make_shared<Blob>(this ->data , size);
58-
59- new_blob->begin = begin;/* FIXME this should go private once*/
60- new_blob->end = begin + n -1 ;
61-
62- begin += n;
58+ std::shared_ptr<Blob> new_blob = std::make_shared<Blob>(this ->data + begin, chop_size);
59+ begin += chop_size;
6360
6461return new_blob;
6562}
6663
67- std::vector< char >
68- Blob::ChopBlank (StampBase &stamp )
64+ std::shared_ptr<Blob >
65+ Blob::Chop ( size_t min_size, size_t max_size )
6966{
70- if (stamp. minSize () > this ->Size ())
67+ if (this ->Size () < min_size )
7168 {
7269throw OutOfData ();
7370 }
74- size_t res_size;
75- if (stamp.isUnbounded ())
76- {
77- res_size =this ->Size ();
78- }else
79- {
80- res_size = stamp.maxSize ();
81- if (res_size >this ->Size ())
82- res_size =this ->Size ();
83- }
84- std::vector<char >res ((char *)this ->data +this ->begin , (char *)this ->data +this ->begin + res_size);
85- this ->begin += res_size;
86- return res;
71+ if (this ->Size () >= max_size)
72+ return this ->Chop (max_size);
73+
74+ return this ->Chop (this ->Size ());
8775}
8876
77+ std::vector<char >
78+ Blob::AsByteVector ()
79+ {
80+ std::vector<char >res (data + begin, data + begin + size);
81+ return res;
82+ }
8983
9084size_t
9185Blob::Size ()