1 /*=========================================================================
3 Program: Visualization Toolkit
4 Module: $RCSfile: vtkBase64OutputStream.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 vtkBase64OutputStream - Writes base64-encoded output to a stream.
19 // .SECTION Description
20 // vtkBase64OutputStream implements base64 encoding with the
21 // vtkOutputStream interface.
23 #ifndef __vtkBase64OutputStream_h
24 #define __vtkBase64OutputStream_h
26 #include "vtkOutputStream.h"
28 class VTK_IO_EXPORT vtkBase64OutputStream : public vtkOutputStream
31 vtkTypeRevisionMacro(vtkBase64OutputStream,vtkOutputStream);
32 static vtkBase64OutputStream *New();
33 void PrintSelf(ostream& os, vtkIndent indent);
36 // Called after the stream position has been set by the caller, but
37 // before any Write calls. The stream position should not be
38 // adjusted by the caller until after an EndWriting call.
42 // Write output data of the given length.
43 int Write(const unsigned char* data, unsigned long length);
46 // Called after all desired calls to Write have been made. After
47 // this call, the caller is free to change the position of the
48 // stream. Additional writes should not be done until after another
49 // call to StartWriting.
53 vtkBase64OutputStream();
54 ~vtkBase64OutputStream();
56 // Number of un-encoded bytes left in Buffer from last call to Write.
57 unsigned int BufferLength;
58 unsigned char Buffer[2];
60 // Methods to encode and write data.
61 int EncodeTriplet(unsigned char c0, unsigned char c1, unsigned char c2);
62 int EncodeEnding(unsigned char c0, unsigned char c1);
63 int EncodeEnding(unsigned char c0);
66 vtkBase64OutputStream(const vtkBase64OutputStream&); // Not implemented.
67 void operator=(const vtkBase64OutputStream&); // Not implemented.