1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-24 02:12:15 -05:00

Merge branch 'remove_non_api_dependencies'

This commit is contained in:
cketti 2011-03-24 19:35:12 +01:00
commit 83451cff10
7 changed files with 73 additions and 12 deletions

View File

@ -8,7 +8,5 @@
<classpathentry kind="lib" path="libs/commons-io-2.0.1.jar"/>
<classpathentry kind="lib" path="libs/jzlib-1.0.7.jar"/>
<classpathentry kind="lib" path="libs/jutf7-1.0.1-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="compile-only-libs/commons-codec-1.3.jar"/>
<classpathentry kind="lib" path="compile-only-libs/commons-logging-1.1.1.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -17,11 +17,6 @@
package com.fsck.k9.mail.filter;
import org.apache.commons.codec.BinaryDecoder;
import org.apache.commons.codec.BinaryEncoder;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.EncoderException;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
@ -38,7 +33,7 @@ import java.math.BigInteger;
* @since 1.0-dev
* @version $Id$
*/
public class Base64 implements BinaryEncoder, BinaryDecoder {
public class Base64 {
/**
* Chunk size per RFC 2045 section 6.8.
*
@ -759,4 +754,16 @@ public class Base64 implements BinaryEncoder, BinaryDecoder {
return resizedBytes;
}
static class DecoderException extends Exception {
DecoderException(String error) {
super(error);
}
}
static class EncoderException extends Exception {
EncoderException(String error) {
super(error);
}
}
}

View File

@ -0,0 +1,57 @@
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.fsck.k9.mail.filter;
/**
* This code was copied from the Apache Commons project.
* The unnecessary parts have been left out.
*/
public class Hex
{
/**
* Used building output as Hex
*/
private static final char[] DIGITS = {
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
};
/**
* Converts an array of bytes into an array of characters representing the hexidecimal values of each byte in order.
* The returned array will be double the length of the passed array, as it takes two characters to represent any
* given byte.
*
* @param data
* a byte[] to convert to Hex characters
* @return A char[] containing hexidecimal characters
*/
public static char[] encodeHex(byte[] data) {
int l = data.length;
char[] out = new char[l << 1];
// two characters form the hex value.
for (int i = 0, j = 0; i < l; i++) {
out[j++] = DIGITS[(0xF0 & data[i]) >>> 4 ];
out[j++] = DIGITS[ 0x0F & data[i] ];
}
return out;
}
}

View File

@ -47,9 +47,6 @@ import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLException;
import javax.net.ssl.TrustManager;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.binary.Hex;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
@ -76,9 +73,11 @@ import com.fsck.k9.mail.Part;
import com.fsck.k9.mail.PushReceiver;
import com.fsck.k9.mail.Pusher;
import com.fsck.k9.mail.Store;
import com.fsck.k9.mail.filter.Base64;
import com.fsck.k9.mail.filter.CountingOutputStream;
import com.fsck.k9.mail.filter.EOLConvertingOutputStream;
import com.fsck.k9.mail.filter.FixedLengthInputStream;
import com.fsck.k9.mail.filter.Hex;
import com.fsck.k9.mail.filter.PeekableInputStream;
import com.fsck.k9.mail.internet.MimeBodyPart;
import com.fsck.k9.mail.internet.MimeHeader;

View File

@ -7,6 +7,7 @@ import com.fsck.k9.mail.*;
import com.fsck.k9.mail.Message.RecipientType;
import com.fsck.k9.mail.filter.Base64;
import com.fsck.k9.mail.filter.EOLConvertingOutputStream;
import com.fsck.k9.mail.filter.Hex;
import com.fsck.k9.mail.filter.LineWrapOutputStream;
import com.fsck.k9.mail.filter.PeekableInputStream;
import com.fsck.k9.mail.filter.SmtpDataStuffing;
@ -26,7 +27,6 @@ import java.security.GeneralSecurityException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import org.apache.commons.codec.binary.Hex;
import java.util.*;