1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
<h1> Package ascii85 </h1> <ul id="short-nav">
<li><code>import "encoding/ascii85"</code></li>
<li><a href="#pkg-overview" class="overviewLink">Overview</a></li>
<li><a href="#pkg-index" class="indexLink">Index</a></li>
</ul> <h2 id="pkg-overview">Overview </h2> <p>Package ascii85 implements the ascii85 data encoding as used in the btoa tool and Adobe's PostScript and PDF document formats. </p> <h2 id="pkg-index">Index </h2> <ul id="manual-nav">
<li><a href="#Decode">func Decode(dst, src []byte, flush bool) (ndst, nsrc int, err error)</a></li>
<li><a href="#Encode">func Encode(dst, src []byte) int</a></li>
<li><a href="#MaxEncodedLen">func MaxEncodedLen(n int) int</a></li>
<li><a href="#NewDecoder">func NewDecoder(r io.Reader) io.Reader</a></li>
<li><a href="#NewEncoder">func NewEncoder(w io.Writer) io.WriteCloser</a></li>
<li><a href="#CorruptInputError">type CorruptInputError</a></li>
<li> <a href="#CorruptInputError.Error">func (e CorruptInputError) Error() string</a>
</li>
</ul> <h3>Package files</h3> <p> <span>ascii85.go</span> </p> <h2 id="Decode">func <span>Decode</span> </h2> <pre data-language="go">func Decode(dst, src []byte, flush bool) (ndst, nsrc int, err error)</pre> <p>Decode decodes src into dst, returning both the number of bytes written to dst and the number consumed from src. If src contains invalid ascii85 data, Decode will return the number of bytes successfully written and a <a href="#CorruptInputError">CorruptInputError</a>. Decode ignores space and control characters in src. Often, ascii85-encoded data is wrapped in <~ and ~> symbols. Decode expects these to have been stripped by the caller. </p>
<p>If flush is true, Decode assumes that src represents the end of the input stream and processes it completely rather than wait for the completion of another 32-bit block. </p>
<p><a href="#NewDecoder">NewDecoder</a> wraps an <span>io.Reader</span> interface around Decode. </p>
<h2 id="Encode">func <span>Encode</span> </h2> <pre data-language="go">func Encode(dst, src []byte) int</pre> <p>Encode encodes src into at most <a href="#MaxEncodedLen">MaxEncodedLen</a>(len(src)) bytes of dst, returning the actual number of bytes written. </p>
<p>The encoding handles 4-byte chunks, using a special encoding for the last fragment, so Encode is not appropriate for use on individual blocks of a large data stream. Use <a href="#NewEncoder">NewEncoder</a> instead. </p>
<p>Often, ascii85-encoded data is wrapped in <~ and ~> symbols. Encode does not add these. </p>
<h2 id="MaxEncodedLen">func <span>MaxEncodedLen</span> </h2> <pre data-language="go">func MaxEncodedLen(n int) int</pre> <p>MaxEncodedLen returns the maximum length of an encoding of n source bytes. </p>
<h2 id="NewDecoder">func <span>NewDecoder</span> </h2> <pre data-language="go">func NewDecoder(r io.Reader) io.Reader</pre> <p>NewDecoder constructs a new ascii85 stream decoder. </p>
<h2 id="NewEncoder">func <span>NewEncoder</span> </h2> <pre data-language="go">func NewEncoder(w io.Writer) io.WriteCloser</pre> <p>NewEncoder returns a new ascii85 stream encoder. Data written to the returned writer will be encoded and then written to w. Ascii85 encodings operate in 32-bit blocks; when finished writing, the caller must Close the returned encoder to flush any trailing partial block. </p>
<h2 id="CorruptInputError">type <span>CorruptInputError</span> </h2> <pre data-language="go">type CorruptInputError int64</pre> <h3 id="CorruptInputError.Error">func (CorruptInputError) <span>Error</span> </h3> <pre data-language="go">func (e CorruptInputError) Error() string</pre><div class="_attribution">
<p class="_attribution-p">
© Google, Inc.<br>Licensed under the Creative Commons Attribution License 3.0.<br>
<a href="http://golang.org/pkg/encoding/ascii85/" class="_attribution-link">http://golang.org/pkg/encoding/ascii85/</a>
</p>
</div>
|