return blobTag;
}
+HashTag* CollectionReader::readHashTag() {
+ if (!ensureBufferCapacity(1)) {
+ return NULL;
+ }
+ uint8_t tagId = 0;
+ growingBuffer.read(&tagId, 1);
+ GlobalSettings::isVerbose() && fprintf(stderr, "[%s:%d] read tag id %d.\n", __FILE__, __LINE__, tagId);
+ if (!ensureBufferCapacity(16)) {
+ return NULL;
+ }
+ char hash[16];
+ growingBuffer.read(hash, 16);
+ return new HashTag(tagId, hash);
+}
+
ED2KLink* CollectionReader::getNextLink() {
if (readerInput->isEOF() && !growingBuffer.getRemaining()) {
GlobalSettings::isVerbose() && fprintf(stderr, "[%s:%d] readInput EOF reached.\n", __FILE__, __LINE__);
#include "GrowingBuffer.h"
#include "StringTag.h"
#include "BlobTag.h"
+#include "HashTag.h"
class CollectionReader {
bool ensureBufferCapacity(size_t byteCount);
void readMoreBytes();
- BlobTag* readBlobTag(bool hader);
- StringTag* readStringTag(bool header);
+ BlobTag* readBlobTag(bool header = false);
+ StringTag* readStringTag(bool header = false);
+ HashTag* readHashTag();
private:
ReaderInput* readerInput;