VTK  9.0.20210424
vtkBase64InputStream.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkBase64InputStream.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
23 #ifndef vtkBase64InputStream_h
24 #define vtkBase64InputStream_h
25 
26 #include "vtkIOCoreModule.h" // For export macro
27 #include "vtkInputStream.h"
28 
29 class VTKIOCORE_EXPORT vtkBase64InputStream : public vtkInputStream
30 {
31 public:
34  void PrintSelf(ostream& os, vtkIndent indent) override;
35 
41  void StartReading() override;
42 
47  int Seek(vtkTypeInt64 offset) override;
48 
53  size_t Read(void* data, size_t length) override;
54 
61  void EndReading() override;
62 
63 protected:
66 
67  // Number of decoded bytes left in Buffer from last call to Read.
69  unsigned char Buffer[2];
70 
71  // Reads 4 bytes from the input stream and decodes them into 3 bytes.
72  int DecodeTriplet(unsigned char& c0, unsigned char& c1, unsigned char& c2);
73 
74 private:
76  void operator=(const vtkBase64InputStream&) = delete;
77 };
78 
79 #endif
vtkBase64InputStream::New
static vtkBase64InputStream * New()
vtkBase64InputStream::BufferLength
int BufferLength
Definition: vtkBase64InputStream.h:68
vtkX3D::data
@ data
Definition: vtkX3D.h:321
vtkBase64InputStream::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkX3D::length
@ length
Definition: vtkX3D.h:399
vtkBase64InputStream::DecodeTriplet
int DecodeTriplet(unsigned char &c0, unsigned char &c1, unsigned char &c2)
vtkBase64InputStream::EndReading
void EndReading() override
Called after all desired calls to Seek and Read have been made.
vtkInputStream.h
vtkX3D::offset
@ offset
Definition: vtkX3D.h:444
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:34
vtkBase64InputStream
Reads base64-encoded input from a stream.
Definition: vtkBase64InputStream.h:30
vtkBase64InputStream::vtkBase64InputStream
vtkBase64InputStream()
vtkBase64InputStream::~vtkBase64InputStream
~vtkBase64InputStream() override
vtkInputStream
Wraps a binary input stream with a VTK interface.
Definition: vtkInputStream.h:34
vtkBase64InputStream::StartReading
void StartReading() override
Called after the stream position has been set by the caller, but before any Seek or Read calls.
vtkBase64InputStream::Seek
int Seek(vtkTypeInt64 offset) override
Seek to the given offset in the input data.
vtkBase64InputStream::Read
size_t Read(void *data, size_t length) override
Read input data of the given length.