#include <ossimS3StreamBuffer.h>
Definition at line 35 of file ossimS3StreamBuffer.h.
◆ S3StreamBuffer()
◆ ~S3StreamBuffer()
ossim::S3StreamBuffer::~S3StreamBuffer |
( |
| ) |
|
|
virtual |
◆ clearAll()
void ossim::S3StreamBuffer::clearAll |
( |
| ) |
|
|
protected |
Definition at line 268 of file ossimS3StreamBuffer.cpp.
void setBytes(ossim_int64 startByte, ossim_int64 currentByte, ossim_int64 endByte)
ossim_int64 m_currentBlockPosition
◆ getAbsoluteByteOffset()
ossim_int64 ossim::S3StreamBuffer::getAbsoluteByteOffset |
( |
| ) |
const |
|
protected |
Definition at line 541 of file ossimS3StreamBuffer.cpp.
const ossim_int64 & getCurrentByte() const
ossim_int64 m_currentBlockPosition
◆ getBlockIndex()
◆ getBlockOffset()
◆ getBlockRangeInBytes()
◆ getBlockSize()
◆ getFileSize()
◆ is_open()
bool ossim::S3StreamBuffer::is_open |
( |
| ) |
const |
|
inline |
◆ loadBlock()
bool ossim::S3StreamBuffer::loadBlock |
( |
ossim_int64 |
absolutePosition | ) |
|
|
protected |
Definition at line 127 of file ossimS3StreamBuffer.cpp.
132 <<
"ossim::S3StreamBuffer::loadBlock DEBUG: entered with absolute position: " << absolutePosition <<
"\n";
137 GetObjectRequest getObjectRequest;
145 stringStream <<
"bytes=" << startRange <<
"-" << endRange;
146 getObjectRequest.WithBucket(
m_bucket.c_str())
147 .WithKey(
m_key.c_str()).WithRange(stringStream.str().c_str());
148 auto getObjectOutcome =
m_client->GetObject(getObjectRequest);
150 if(getObjectOutcome.IsSuccess())
153 Aws::IOStream& bodyStream = getObjectOutcome.GetResult().GetBody();
154 ossim_int64 bufSize = getObjectOutcome.GetResult().GetContentLength();
157 bodyStream.read(&
m_buffer.front(), bufSize);
177 <<
"ossim::S3StreamBuffer::loadBlock DEBUG: leaving with absolutePosition " << absolutePosition <<
"\n";
std::vector< char > m_buffer
void setBytes(ossim_int64 startByte, ossim_int64 currentByte, ossim_int64 endByte)
bool getBlockRangeInBytes(ossim_int64 blockIndex, ossim_int64 &startRange, ossim_int64 &endRange) const
ossim_int64 getBlockIndex(ossim_int64 byteOffset) const
std::basic_stringstream< char > stringstream
Class for char mixed input and output memory streams.
std::shared_ptr< Aws::S3::S3Client > m_client
ossim_int64 m_currentBlockPosition
ossim_int64 m_bufferActualDataSize
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
◆ open() [1/2]
Definition at line 184 of file ossimS3StreamBuffer.cpp.
Referenced by ossim::S3IStream::open().
188 std::string temp(connectionString);
189 return open(temp, options, m);
S3StreamBuffer * open(const char *connectionString, const ossimKeywordlist &options, std::ios_base::openmode mode)
◆ open() [2/2]
Definition at line 192 of file ossimS3StreamBuffer.cpp.
199 <<
"ossim::S3StreamBuffer::open DEBUG: entered..... with connection " << connectionString << std::endl;
208 if( (url.getProtocol() ==
"s3") || (url.getProtocol() ==
"S3") )
212 m_key = url.getPath().c_str();
226 HeadObjectRequest headObjectRequest;
227 headObjectRequest.WithBucket(
m_bucket.c_str())
228 .WithKey(
m_key.c_str());
229 auto headObject =
m_client->HeadObject(headObjectRequest);
230 if(headObject.IsSuccess())
232 m_fileSize = headObject.GetResult().GetContentLength();
256 <<
"ossim::S3StreamBuffer::open DEBUG: Took " << delta <<
" seconds to open" << std::endl;
258 <<
"ossim::S3StreamBuffer::open DEBUG: leaving....." << std::endl;
unsigned long long Timer_t
static ossimTimer * instance()
std::shared_ptr< Aws::S3::S3Client > m_client
ossim_int64 m_currentBlockPosition
Timer_t tick() const
Get the timers tick value.
double delta_s(Timer_t t1, Timer_t t2) const
Get the time in seconds between timer ticks t1 and t2.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
◆ seekoff()
ossim::S3StreamBuffer::pos_type ossim::S3StreamBuffer::seekoff |
( |
off_type |
offset, |
|
|
std::ios_base::seekdir |
dir, |
|
|
std::ios_base::openmode |
__mode = std::ios_base::in | std::ios_base::out |
|
) |
| |
|
protectedvirtual |
Definition at line 309 of file ossimS3StreamBuffer.cpp.
316 pos_type result = pos_type(off_type(-1));
318 if((mode & std::ios_base::in)&&
319 (mode & std::ios_base::out))
325 case std::ios_base::beg:
342 result = pos_type(offset);
352 if(mode & std::ios_base::in)
356 setg(eback(), gptr()+delta, egptr());
362 case std::ios_base::cur:
381 setg(eback(), gptr()+offset, egptr());
387 case std::ios_base::end:
398 ossim_int64 delta = absolutePosition-currentAbsolutePosition;
402 if(mode & std::ios_base::in )
404 setg(eback(), gptr()+delta, egptr());
406 result = absolutePosition;
void setCurrentByte(ossim_int64 currentByte)
const ossim_int64 & getCurrentByte() const
ossim_int64 getAbsoluteByteOffset() const
◆ seekpos()
ossim::S3StreamBuffer::pos_type ossim::S3StreamBuffer::seekpos |
( |
pos_type |
pos, |
|
|
std::ios_base::openmode |
mode = std::ios_base::in | std::ios_base::out |
|
) |
| |
|
protectedvirtual |
Definition at line 420 of file ossimS3StreamBuffer.cpp.
423 pos_type result = pos_type(off_type(-1));
434 if(mode & std::ios_base::in)
442 setg(eback(), gptr()+delta, egptr());
void setCurrentByte(ossim_int64 currentByte)
ossim_int64 getAbsoluteByteOffset() const
◆ underflow()
int ossim::S3StreamBuffer::underflow |
( |
| ) |
|
|
protectedvirtual |
Definition at line 279 of file ossimS3StreamBuffer.cpp.
288 if(absolutePosition < 0)
bool withinWindow() const
ossim_int64 getAbsoluteByteOffset() const
bool loadBlock(ossim_int64 absolutePosition)
unsigned char ossim_uint8
◆ withinWindow()
bool ossim::S3StreamBuffer::withinWindow |
( |
| ) |
const |
|
protected |
Definition at line 559 of file ossimS3StreamBuffer.cpp.
561 if(!gptr())
return false;
562 return ((gptr()>=eback()) && (gptr()<egptr()));
◆ xsgetn()
std::streamsize ossim::S3StreamBuffer::xsgetn |
( |
char_type * |
s, |
|
|
std::streamsize |
n |
|
) |
| |
|
protectedvirtual |
Definition at line 450 of file ossimS3StreamBuffer.cpp.
References n.
487 bytesNeedToRead = (
m_fileSize - currentAbsolutePosition);
490 while(bytesNeedToRead > 0)
504 if(currentAbsolutePosition>=0)
510 if(delta <= bytesNeedToRead)
513 std::memcpy(s+bytesRead, gptr(), delta);
517 bytesNeedToRead-=delta;
519 setg(eback(), gptr()+delta, egptr());
524 std::memcpy(s+bytesRead, gptr(), bytesNeedToRead);
525 setg(eback(), gptr()+bytesNeedToRead, egptr());
529 bytesRead+=bytesNeedToRead;
538 return std::streamsize(bytesRead);
const ossim_int64 & getEndByte() const
bool withinWindow() const
void setCurrentByte(ossim_int64 currentByte)
os2<< "> n<< " > nendobj n
const ossim_int64 & getCurrentByte() const
bool loadBlock(ossim_int64 absolutePosition)
◆ m_blockInfo
◆ m_bucket
std::string ossim::S3StreamBuffer::m_bucket |
|
protected |
◆ m_buffer
std::vector<char> ossim::S3StreamBuffer::m_buffer |
|
protected |
◆ m_bufferActualDataSize
ossim_int64 ossim::S3StreamBuffer::m_bufferActualDataSize |
|
protected |
◆ m_bufferPtr
char* ossim::S3StreamBuffer::m_bufferPtr |
|
protected |
◆ m_client
std::shared_ptr<Aws::S3::S3Client> ossim::S3StreamBuffer::m_client |
|
mutableprotected |
◆ m_currentBlockPosition
ossim_int64 ossim::S3StreamBuffer::m_currentBlockPosition |
|
protected |
◆ m_fileSize
◆ m_key
std::string ossim::S3StreamBuffer::m_key |
|
protected |
◆ m_opened
bool ossim::S3StreamBuffer::m_opened |
|
protected |
The documentation for this class was generated from the following files: