/help/Mime.dtx

https://github.com/the-Arioch/jcl · Unknown · 220 lines · 220 code · 0 blank · 0 comment · 0 complexity · 70ca6caedb2c93ff07199a71be58825b MD5 · raw file

  1. @@EJclMimeError
  2. <GROUP MIME>
  3. Summary:
  4. Base class for exceptions raised in response to MIME encoding/decoding errors.
  5. Description:
  6. The EJclMimeError class is the exception class that is raised when an error occurs
  7. within one of MIME-routines.
  8. Donator:
  9. Ralf Junker
  10. --------------------------------------------------------------------------------
  11. @@MimeEncodeString
  12. <GROUP MIME>
  13. Summary:
  14. MIME-Encodes a string.
  15. Description:
  16. MimeEncodeString encodes the supplied string with a MIME64 encoding algorithm.
  17. Parameters:
  18. s - String to be encoded.
  19. Result:
  20. MIME encoded string.
  21. See also:
  22. MimeDecodeString
  23. MimeEncodeStream
  24. MimeEncode
  25. MimeEncodedSize
  26. Donator:
  27. Ralf Junker
  28. --------------------------------------------------------------------------------
  29. @@MimeDecodeString
  30. <GROUP MIME>
  31. Summary:
  32. MIME-Decodes a string.
  33. Description:
  34. MimeDecodeString decodes the supplied MIME64-encoded string.
  35. Parameters:
  36. s - MIME64-encoded string to be decoded.
  37. Result:
  38. Decoded string.
  39. See also:
  40. MimeEncodeString
  41. MimeDecodeStream
  42. MimeDecode
  43. MimeDecodedSize
  44. Donator:
  45. Ralf Junker
  46. --------------------------------------------------------------------------------
  47. @@MimeEncodeStream
  48. <GROUP MIME>
  49. Summary:
  50. MIME-Encodes a stream.
  51. Description:
  52. MimeEncodeStream encodes InputStream starting at the current position up to the
  53. end and writes the result to OutputStream, again starting at the current
  54. position. When done, it will not reset either stream's positions, but leave
  55. InputStream at the last read position (i.e. the end) and OutputStream at the
  56. last write position (which can, but is not always the end).
  57. To encode the entire InputStream from beginning to end, make sure that its
  58. offset is positioned at the beginning of the stream. You can force this by
  59. issuing Seek (0, soFromBeginning) before calling this function.
  60. Parameters:
  61. InputStream - Input stream to be encoded.
  62. OutputStream - Output stream.
  63. See also:
  64. MimeDecodeStream
  65. MimeEncodeString
  66. MimeEncode
  67. MimeEncodedSize
  68. Donator:
  69. Ralf Junker
  70. --------------------------------------------------------------------------------
  71. @@MimeDecodeStream
  72. <GROUP MIME>
  73. Summary:
  74. Decodes a MIME-encoded stream.
  75. Description:
  76. MimeDecodeStream decodes InputStream starting at the current position up to the
  77. end and writes the result to OutputStream, again starting at the current
  78. position. When done, it will not reset either stream's positions, but leave
  79. InputStream at the last read position (i.e. the end) and OutputStream at the
  80. last write position (which can, but is not always the end).
  81. To decode the entire InputStream from beginning to end, make sure that its
  82. offset is positioned at the beginning of the stream. You can force this by
  83. issuing Seek (0, soFromBeginning) before calling this function.
  84. Parameters:
  85. InputStream - Input stream to be decoded.
  86. OutputStream - Output stream.
  87. See also:
  88. MimeEncodeStream
  89. MimeDecodeString
  90. MimeDecode
  91. MimeDecodedSize
  92. Donator:
  93. Ralf Junker
  94. --------------------------------------------------------------------------------
  95. @@MimeEncodedSize
  96. <GROUP MIME>
  97. Summary:
  98. Calculates the output size for encoding.
  99. Description:
  100. MimeEncodedSize calculates the output size of I MimeEncoded bytes. Use for MimeEncode only.
  101. Parameters:
  102. I - Number of bytes to encode.
  103. Result:
  104. Number of bytes needed for encoding.
  105. See also:
  106. MimeEncode
  107. MimeDecodedSize
  108. Donator:
  109. Ralf Junker
  110. --------------------------------------------------------------------------------
  111. @@MimeDecodedSize
  112. <GROUP MIME>
  113. Summary:
  114. Calculates the output size for decoding.
  115. Description:
  116. MimeDecodedSize calculates the maximum output size of I MimeDecoded bytes. You
  117. may use it for MimeDecode to calculate the maximum amount of memory required for
  118. decoding in one single pass.
  119. Parameters:
  120. I - Number of bytes to decode.
  121. Result:
  122. Maximum number of bytes needed for decoding.
  123. See also:
  124. MimeDecode
  125. MimeEncodedSize
  126. Donator:
  127. Ralf Junker
  128. --------------------------------------------------------------------------------
  129. @@MimeEncode
  130. <GROUP MIME>
  131. Summary:
  132. The primary Mime encoding routine.
  133. Description:
  134. MimeEncode is the primary MIME-encoding routine and is used by MimeEncodeString
  135. and MimeEncodeStream but can also be used directly.
  136. CAUTION: OutputBuffer must have enough memory allocated to take all encoded
  137. output. MimeEncodedSize(InputBytesCount) calculates this amount in bytes.
  138. MimeEncode will then fill the entire OutputBuffer, so there is no
  139. OutputBytesCount result for this procedure. Preallocating all memory at once (as
  140. required by MimeEncode) avoids the time-consuming process of reallocation.
  141. Parameters:
  142. InputBuffer - Points to the memory block to encode.
  143. InputByteCount - Number of bytes to encode.
  144. OutputBuffer - Points to the output buffer.
  145. Notes:
  146. If not all data fits into memory at once, you can use MimeEncode multiple times, but you must be very careful about the size of the InputBuffer. It should be set to a number that is a multiple of 3.
  147. See also:
  148. MimeEncodedSize
  149. MimeDecode
  150. Donator:
  151. Ralf Junker
  152. --------------------------------------------------------------------------------
  153. @@MimeDecode
  154. <GROUP MIME>
  155. Summary:
  156. The primary Mime decoding routine.
  157. Description:
  158. MimeDecode is the primary MIME-decoding routine and can also be used directly.
  159. CAUTION: OutputBuffer must have enough memory allocated to take all
  160. output. MimeDecodedSize(InputBytesCount) calculates this amount in bytes. There is no
  161. guarantee that all output will be filled after decoding. MimeDecode therefore
  162. returns the actual number of bytes written to OutputBuffer. Preallocating all
  163. memory at once (as is required by MimeDecode) avoids the time-consuming process
  164. of reallocation. After calling MimeDecode, simply cut the allocated memory down
  165. to OutputBytesCount, i.e. SetLength(OutString, OutputBytesCount).
  166. Parameters:
  167. InputBuffer - Points to the memory block to encode.
  168. InputBytesCount - Number of bytes to encode.
  169. OutputBuffer - Points to the output buffer.
  170. Result:
  171. Number of bytes actually written to the OutputBuffer.
  172. See also:
  173. MimeDecodedSize
  174. MimeEncode
  175. Donator:
  176. Ralf Junker
  177. --------------------------------------------------------------------------------
  178. @@MimeDecodePartial
  179. <GROUP MIME>
  180. Summary:
  181. MIME decode a chunk of data in a multi-phase decoding routine.
  182. Description:
  183. MIME decodes a chunk of data in a mutli-phase decoding routine. It is used
  184. within MimeDecodeString, MimeDecodeStream, and MimeDecode, but can also be used
  185. directly.
  186. Parameters:
  187. InputBuffer - Buffer to decode.
  188. InputBytesCount - Number of bytes to decode.
  189. OutputBuffer - Points to the output buffer.
  190. ByteBuffer - Bytes of buffer from previous call.
  191. ByteBufferSpace - Number of bytes to read before ByteBuffer is full.
  192. Result:
  193. Number of bytes actually written to the OutputBuffer.
  194. Notes:
  195. On first call ByteBuffer should be 0 (zero) and ByteBufferSpace should be 4. The values returned in these parameters should be used in the next call to MimeDecodePartial or MimeDecodePartialEnd.
  196. See also:
  197. MimeDecodePartialEnd
  198. Donator:
  199. Ralf Junker
  200. --------------------------------------------------------------------------------
  201. @@MimeDecodePartialEnd
  202. <GROUP MIME>
  203. Summary:
  204. MIME decode the last chunk of data in a multi-phase decoding routine.
  205. Description:
  206. MIME decodes the last chunk of data in a mutli-phase decoding routine. It is
  207. used within MimeDecodeString, MimeDecodeStream, and MimeDecode, but can also be
  208. used directly.
  209. Parameters:
  210. OutputBuffer - Points to the output buffer.
  211. ByteBuffer - Bytes of buffer from previous call.
  212. ByteBufferSpace - Number of bytes to read before ByteBuffer is full
  213. Result:
  214. Number of bytes actually written to the OutputBuffer.
  215. Notes:
  216. ByteBuffer and ByteBufferSpace are the values returned in the last call to MimeDecodePartial.
  217. See also:
  218. MimeDecodePartial
  219. Donator:
  220. Ralf Junker