VTK  9.3.20240328
vtkBase64InputStream.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
11 #ifndef vtkBase64InputStream_h
12 #define vtkBase64InputStream_h
13 
14 #include "vtkIOCoreModule.h" // For export macro
15 #include "vtkInputStream.h"
16 
17 VTK_ABI_NAMESPACE_BEGIN
18 class VTKIOCORE_EXPORT vtkBase64InputStream : public vtkInputStream
19 {
20 public:
23  void PrintSelf(ostream& os, vtkIndent indent) override;
24 
30  void StartReading() override;
31 
36  int Seek(vtkTypeInt64 offset) override;
37 
42  size_t Read(void* data, size_t length) override;
43 
50  void EndReading() override;
51 
52 protected:
55 
56  // Number of decoded bytes left in Buffer from last call to Read.
58  unsigned char Buffer[2];
59 
60  // Reads 4 bytes from the input stream and decodes them into 3 bytes.
61  int DecodeTriplet(unsigned char& c0, unsigned char& c1, unsigned char& c2);
62 
63 private:
65  void operator=(const vtkBase64InputStream&) = delete;
66 };
67 
68 VTK_ABI_NAMESPACE_END
69 #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:108
Wraps a binary input stream with a VTK interface.
@ length
Definition: vtkX3D.h:393
@ offset
Definition: vtkX3D.h:438
@ data
Definition: vtkX3D.h:315