/usr/include/CLucene/util/streamarray.h is in libclucene-dev 2.3.3.4+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | /*------------------------------------------------------------------------------
* Copyright (C) 2009 Isidor Zeuner
*
* Distributable under the terms of either the Apache License (Version 2.0) or
* the GNU Lesser General Public License, as specified in the COPYING file.
------------------------------------------------------------------------------*/
#ifndef CLUCENE_UTIL_STREAMARRAY_H
#define CLUCENE_UTIL_STREAMARRAY_H
#include <cstring>
#include "CLucene/util/CLStreams.h"
#include "CLucene/util/Array.h"
CL_NS_DEF(util)
template<typename element>
ValueArray<element> streamArray(CL_NS(util)::CLStream<element>* stored) {
size_t const block_size = 4096;
element const* retrieved;
ValueArray<element> result(0);
size_t available;
size_t offset = 0;
do {
available = stored->read(retrieved, block_size, block_size);
result.resize(result.length + sizeof(element) * available);
memcpy(result.values + offset, retrieved, sizeof(element) * available);
offset += available;
} while (block_size == available);
return result;
}
CL_NS_END
#endif
|