# package ascii85
`import "encoding/ascii85"`
ascii85包实现了ascii85数据编码(5个ascii字符表示4个字节),该编码用于btoa工具和Adobe的PostScript语言和PDF文档格式。
## Index
* [type CorruptInputError](#CorruptInputError)
* [func (e CorruptInputError) Error() string](#CorruptInputError.Error)
* [func MaxEncodedLen(n int) int](#MaxEncodedLen)
* [func Encode(dst, src []byte) int](#Encode)
* [func Decode(dst, src []byte, flush bool) (ndst, nsrc int, err error)](#Decode)
* [func NewEncoder(w io.Writer) io.WriteCloser](#NewEncoder)
* [func NewDecoder(r io.Reader) io.Reader](#NewDecoder)
## type [CorruptInputError](https://github.com/golang/go/blob/master/src/encoding/ascii85/ascii85.go#L169 "View Source")
```
type CorruptInputError int64
```
### func (CorruptInputError) [Error](https://github.com/golang/go/blob/master/src/encoding/ascii85/ascii85.go#L171 "View Source")
```
func (e CorruptInputError) Error() string
```
## func [MaxEncodedLen](https://github.com/golang/go/blob/master/src/encoding/ascii85/ascii85.go#L86 "View Source")
```
func MaxEncodedLen(n int) int
```
返回n字节源数据编码后的最大字节数。
## func [Encode](https://github.com/golang/go/blob/master/src/encoding/ascii85/ascii85.go#L27 "View Source")
```
func Encode(dst, src []byte) int
```
将src编码成最多MaxEncodedLen(len(src))数据写入dst,返回实际写入的字节数。编码每4字节一段进行一次,最后一个片段采用特殊的处理方式,因此不应将本函数用于处理大数据流的某一独立数据块。
一般来说ascii85编码数据会被'<~'和'~>'包括起来,函数并未添加上它们。
## func [Decode](https://github.com/golang/go/blob/master/src/encoding/ascii85/ascii85.go#L189 "View Source")
```
func Decode(dst, src []byte, flush bool) (ndst, nsrc int, err error)
```
将src解码后写入dst,返回写入dst的字节数、从src解码的字节数。如果src含有非法数据,函数将返回成功执行的数据(两个数字)和CorruptInputError。如果flush为真,则函数会认为src代表输入流的结尾,完全处理src,而不会等待另一个32字节的数据块。
函数会忽略src中的空格和控制字符,一般来说ascii85编码数据会被'<~'和'~>'包括起来,但是调用者应自行去掉它们。
## func [NewEncoder](https://github.com/golang/go/blob/master/src/encoding/ascii85/ascii85.go#L93 "View Source")
```
func NewEncoder(w io.Writer) io.WriteCloser
```
创建一个将数据编码为ascii85流写入w的编码器。Ascii85编码算法操作32位块,写入结束后,必须调用Close方法将缓存中保留的不完整块刷新到w里。
## func [NewDecoder](https://github.com/golang/go/blob/master/src/encoding/ascii85/ascii85.go#L246 "View Source")
```
func NewDecoder(r io.Reader) io.Reader
```
创建一个从r解码ascii85流的解码器。
- 库
- package achive
- package tar
- package zip
- package bufio
- package builtin
- package bytes
- package compress
- package bzip2
- package flate
- package gzip
- package lzw
- package zlib
- package container
- package heap
- package list
- package ring
- package crypto
- package aes
- package cipher
- package des
- package dsa
- package ecdsa
- package elliptic
- package hmac
- package md5
- package rand
- package rc4
- package rsa
- package sha1
- package sha256
- package sha512
- package subtle
- package tls
- package x509
- package pkix
- package database
- package sql
- package driver
- package encoding
- package ascii85
- package asn1
- package base32
- package base64
- package binary
- package csv
- package gob
- package hex
- package json
- package pem
- package xml
- package errors
- package expvar
- package flag
- package fmt
- package go
- package doc
- package format
- package parser
- package printer
- package hash
- package adler32
- package crc32
- package crc64
- package fnv
- package html
- package template
- package image
- package color
- package palette
- package draw
- package gif
- package jpeg
- package png
- package index
- package suffixarray
- package io
- package ioutil
- package log
- package syslog
- package math
- package big
- package cmplx
- package rand
- package mime
- package multipart
- package net
- package http
- package cgi
- package cookiejar
- package fcgi
- package httptest
- package httputil
- package pprof
- package mail
- package rpc
- package jsonrpc
- package smtp
- package textproto
- package url
- package os
- package exec
- package signal
- package user
- package path
- package filepath
- package reflect
- package regexp
- package runtime
- package cgo
- package debug
- package pprof
- package race
- package sort
- package strconv
- package strings
- package sync
- package atomic
- package text
- package scanner
- package tabwriter
- package template
- package time
- package unicode
- package utf16
- package utf8
- package unsafe