00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkBase64InputStream.h,v $ 00005 Language: C++ 00006 00007 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 00008 All rights reserved. 00009 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00010 00011 This software is distributed WITHOUT ANY WARRANTY; without even 00012 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00013 PURPOSE. See the above copyright notice for more information. 00014 00015 =========================================================================*/ 00036 #ifndef __vtkBase64InputStream_h 00037 #define __vtkBase64InputStream_h 00038 00039 #include "vtkInputStream.h" 00040 00041 class VTK_IO_EXPORT vtkBase64InputStream : public vtkInputStream 00042 { 00043 public: 00044 vtkTypeRevisionMacro(vtkBase64InputStream,vtkInputStream); 00045 static vtkBase64InputStream *New(); 00046 void PrintSelf(ostream& os, vtkIndent indent); 00047 00051 void StartReading(); 00052 00055 int Seek(unsigned long offset); 00056 00058 unsigned long Read(unsigned char* data, unsigned long length); 00059 00064 void EndReading(); 00065 protected: 00066 vtkBase64InputStream(); 00067 ~vtkBase64InputStream(); 00068 00069 // Number of decoded bytes left in Buffer from last call to Read. 00070 int BufferLength; 00071 unsigned char Buffer[2]; 00072 00073 // Reads 4 bytes from the input stream and decodes them into 3 bytes. 00074 int DecodeTriplet(unsigned char& c0, unsigned char& c1, unsigned char& c2); 00075 00076 private: 00077 vtkBase64InputStream(const vtkBase64InputStream&); // Not implemented. 00078 void operator=(const vtkBase64InputStream&); // Not implemented. 00079 }; 00080 00081 #endif