#pragma once
#include <vector>
#include <string>
class BufferedReader {
 public:
     explicit BufferedReader(PackageStream* stream) {
         this->stream1 = stream;
     }

     int32_t Read(char* output_buffer, int32_t buffer_len) {
         int temp;
         length = 0;
         test.resize(buffer_len);
         while (length < buffer_len) {
             temp = length;
             length += this->stream1->ReadPackage(output_buffer);
             string temp1(output_buffer);
             if (temp - length == 0) {
                 for (unsigned int i = 0; i < test.length()-1; i++) {
                     output_buffer[i] = test[i];
                 }
                 return 5;
             }
         }
         return 5;
     }
     PackageStream* stream1;
     string test;
    int length = 0;
};