VTK
dox/IO/vtkBase64InputStream.h
Go to the documentation of this file.
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   
00047 
00051   void EndReading();
00052 protected:
00053   vtkBase64InputStream();
00054   ~vtkBase64InputStream();  
00056   
00057   // Number of decoded bytes left in Buffer from last call to Read.
00058   int BufferLength;
00059   unsigned char Buffer[2];
00060   
00061   // Reads 4 bytes from the input stream and decodes them into 3 bytes.
00062   int DecodeTriplet(unsigned char& c0, unsigned char& c1, unsigned char& c2);
00063 
00064 private:
00065   vtkBase64InputStream(const vtkBase64InputStream&);  // Not implemented.
00066   void operator=(const vtkBase64InputStream&);  // Not implemented.
00067 };
00068 
00069 #endif