00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkBase64InputStream.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00022 #ifndef __vtkBase64InputStream_h 00023 #define __vtkBase64InputStream_h 00024 00025 #include "vtkInputStream.h" 00026 00027 class VTK_IO_EXPORT vtkBase64InputStream : public vtkInputStream 00028 { 00029 public: 00030 vtkTypeMacro(vtkBase64InputStream,vtkInputStream); 00031 static vtkBase64InputStream *New(); 00032 void PrintSelf(ostream& os, vtkIndent indent); 00033 00037 void StartReading(); 00038 00041 int Seek(unsigned long offset); 00042 00044 unsigned long Read(unsigned char* data, unsigned long length); 00045 00050 void EndReading(); 00051 protected: 00052 vtkBase64InputStream(); 00053 ~vtkBase64InputStream(); 00054 00055 // Number of decoded bytes left in Buffer from last call to Read. 00056 int BufferLength; 00057 unsigned char Buffer[2]; 00058 00059 // Reads 4 bytes from the input stream and decodes them into 3 bytes. 00060 int DecodeTriplet(unsigned char& c0, unsigned char& c1, unsigned char& c2); 00061 00062 private: 00063 vtkBase64InputStream(const vtkBase64InputStream&); // Not implemented. 00064 void operator=(const vtkBase64InputStream&); // Not implemented. 00065 }; 00066 00067 #endif