VTK
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 =========================================================================*/
22 #ifndef __vtkBase64InputStream_h
23 #define __vtkBase64InputStream_h
24 
25 #include "vtkIOCoreModule.h" // For export macro
26 #include "vtkInputStream.h"
27 
28 class VTKIOCORE_EXPORT vtkBase64InputStream : public vtkInputStream
29 {
30 public:
32  static vtkBase64InputStream *New();
33  void PrintSelf(ostream& os, vtkIndent indent);
34 
38  void StartReading();
39 
42  int Seek(vtkTypeInt64 offset);
43 
45  size_t Read(void* data, size_t length);
46 
48 
52  void EndReading();
53 protected:
57 
58  // Number of decoded bytes left in Buffer from last call to Read.
60  unsigned char Buffer[2];
61 
62  // Reads 4 bytes from the input stream and decodes them into 3 bytes.
63  int DecodeTriplet(unsigned char& c0, unsigned char& c1, unsigned char& c2);
64 
65 private:
66  vtkBase64InputStream(const vtkBase64InputStream&); // Not implemented.
67  void operator=(const vtkBase64InputStream&); // Not implemented.
68 };
69 
70 #endif