VTK  9.2.20221001
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 VTK_ABI_NAMESPACE_BEGIN
30 class VTKIOCORE_EXPORT vtkBase64InputStream : public vtkInputStream
31 {
32 public:
35  void PrintSelf(ostream& os, vtkIndent indent) override;
36 
42  void StartReading() override;
43 
48  int Seek(vtkTypeInt64 offset) override;
49 
54  size_t Read(void* data, size_t length) override;
55 
62  void EndReading() override;
63 
64 protected:
67 
68  // Number of decoded bytes left in Buffer from last call to Read.
70  unsigned char Buffer[2];
71 
72  // Reads 4 bytes from the input stream and decodes them into 3 bytes.
73  int DecodeTriplet(unsigned char& c0, unsigned char& c1, unsigned char& c2);
74 
75 private:
77  void operator=(const vtkBase64InputStream&) = delete;
78 };
79 
80 VTK_ABI_NAMESPACE_END
81 #endif
Reads base64-encoded input from a stream.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkBase64InputStream * New()
int DecodeTriplet(unsigned char &c0, unsigned char &c1, unsigned char &c2)
void StartReading() override
Called after the stream position has been set by the caller, but before any Seek or Read calls.
int Seek(vtkTypeInt64 offset) override
Seek to the given offset in the input data.
void EndReading() override
Called after all desired calls to Seek and Read have been made.
size_t Read(void *data, size_t length) override
Read input data of the given length.
~vtkBase64InputStream() override
a simple class to control print indentation
Definition: vtkIndent.h:120
Wraps a binary input stream with a VTK interface.
@ length
Definition: vtkX3D.h:405
@ offset
Definition: vtkX3D.h:450
@ data
Definition: vtkX3D.h:327