1 /*=========================================================================
3 Program: Visualization Toolkit
4 Module: $RCSfile: vtkBase64InputStream.h,v $
6 Date: $Date: 2002/10/16 18:23:06 $
7 Version: $Revision: 1.1 $
9 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
11 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notice for more information.
17 =========================================================================*/
18 // .NAME vtkBase64InputStream - Reads base64-encoded input from a stream.
19 // .SECTION Description
20 // vtkBase64InputStream implements base64 decoding with the
21 // vtkInputStream interface.
23 #ifndef __vtkBase64InputStream_h
24 #define __vtkBase64InputStream_h
26 #include "vtkInputStream.h"
28 class VTK_IO_EXPORT vtkBase64InputStream : public vtkInputStream
31 vtkTypeRevisionMacro(vtkBase64InputStream,vtkInputStream);
32 static vtkBase64InputStream *New();
33 void PrintSelf(ostream& os, vtkIndent indent);
36 // Called after the stream position has been set by the caller, but
37 // before any Seek or Read calls. The stream position should not be
38 // adjusted by the caller until after an EndReading call.
42 // Seek to the given offset in the input data. Returns 1 for
43 // success, 0 for failure.
44 int Seek(unsigned long offset);
47 // Read input data of the given length. Returns amount actually
49 unsigned long Read(unsigned char* data, unsigned long length);
52 // Called after all desired calls to Seek and Read have been made.
53 // After this call, the caller is free to change the position of the
54 // stream. Additional reads should not be done until after another
55 // call to StartReading.
58 vtkBase64InputStream();
59 ~vtkBase64InputStream();
61 // Number of decoded bytes left in Buffer from last call to Read.
63 unsigned char Buffer[2];
65 // Reads 4 bytes from the input stream and decodes them into 3 bytes.
66 int DecodeTriplet(unsigned char& c0, unsigned char& c1, unsigned char& c2);
69 vtkBase64InputStream(const vtkBase64InputStream&); // Not implemented.
70 void operator=(const vtkBase64InputStream&); // Not implemented.