As part of an effort to be able to download from anywhere, I developed a comprehensive set of encoding/decoding modules. The following are supported:
PrintableEncodings - encoder/decoder for
uuencode base64 quoted-printable
CompressEngine is the unix "compress" utility.
UncompressInputStream undoes the compression done by the Unix compress utility.
The version here fixes a bug wherein
codes near the end of the stream may be incorrectly processed.
bzip2 compression/decompression is supported by the CBZip2... methods.
src |
Jdoc |
class |
note |
|
|
BZip.java |
DESCRIBE
|
|
|
BZip2Constants.java |
DESCRIBE
|
|
|
CBZip2InputStream.java |
DESCRIBE
|
|
|
CBZip2OutputStream.java |
DESCRIBE
|
|
|
CompressEngine.java |
DESCRIBE
|
|
|
CRC.java |
DESCRIBE
|
|
|
EncodingManager.java |
DESCRIBE
|
|
|
PrintableEncodings.java |
DESCRIBE
|
|
|
UncompressInputStream.java |
DESCRIBE
|
EncodingManage is the primary package managing access to all the others
various constructors
public EncodingManager() {
public EncodingManager(byte[] array) {
public EncodingManager(String s, Charset cs) {
public EncodingManager(ByteBuffer bb) {
public EncodingManager(InputStream instr) {
various inputs
public void setData(ByteBuffer bb) { data = bb; }
various outputs
public ByteBuffer getByteBuffer() { return data; }
public void close() {
public void write(int b) {
public OutputStream getOutputStream() {
public Image toImage() {
public byte[] toBytes() {
public void printBytesInHex(OutputStream os) {
public void writeToFile(String filename) {
public void writeToStream(OutputStream ous) {
public String toString(Charset cs) {
public String toString() {
public String toString(String css) {
operations
public void swapShorts() {
public void swapInts() {
public void swapLongs() {
public void swapFloats() { swapInts(); }
public void swapDoubles() { swapLongs(); }
static public String urlEncode(String s) {
static public String urlDecode(String s) {
public void encode(Compression comp) {
decode(Compression comp) {
BZIP2, // modern Unix program: bzip2 [www.bzip.org]
GZIP, // old Unix program: gzip. uses deflate [RFC 1952]
ZLIB, // simple wrapper to deflate [RFC 1950]
BASE64, // mail transparent; pgm: uuencode -m [RFC 2045]
UU, // mail mostly transparent: pgm: uuencode
QP, // quoted-printable [RFC 2045]
BZIP, // one-time Unix encoding. pgm: bzip.
COMPRESS, // ancient Unix encoding. program: compress
DEFLATE, // compression engine. needs wrapper [RFC 1951]public void
PACK200, // Java tool
(ALSO URL)
BZIP, // one-time Unix encoding. pgm: bzip.
bzipDecode (no encode)
BZIP2, // modern Unix program: bzip2 [www.bzip.org]
bzip2Encode
bzip2Decode
new BZip().uncompressStream ( InputStream instr, OutputStream outstream )
COMPRESS, // ancient Unix encoding. program: compress
compressEncode
compressDecode
c = new CompressEngine(InputStream, OutputStream)
c.input_size(int); (optional)
c.compress() (T === output smaller than input)
does not close the streans
DEFLATE, // compression engine. needs wrapper [RFC 1951]public void
public void deflate(int level)
public void inflate() {
ZLIB, // simple wrapper to deflate [RFC 1950]
public void zlibEncode(int level)
public void zlibDecode() {
GZIP, // old Unix program: gzip. uses deflate [RFC 1952]
public void gzipEncode() {
public void gzipDecode() {
PACK200
Accept-Encoding=pack200-gzip". This indicates to the server that the client application desires a version of the file encoded with Pack200 and further compressed with gzip.
public void pack200Pack() {
public void pack200Unpack() {
UU, // mail mostly transparent: pgm: uuencode
public void uuencode(String mode, String fileName) {
public void uudecode() {
BASE64, // mail transparent; pgm: uuencode -m [RFC 2045]
public void encodeBase64() {
public void decodeBase64() {
QP, // quoted-printable [RFC 2045]
public void encodeQP() {
public void decodeQP() {
|