Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
auto import from //depot/cupcake/@135843
Browse files Browse the repository at this point in the history
  • Loading branch information
The Android Open Source Project committed Mar 4, 2009
1 parent e5d9544 commit 069490a
Show file tree
Hide file tree
Showing 431 changed files with 60,872 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/org/apache/commons/codec/BinaryDecoder.java
@@ -0,0 +1,41 @@
/*
* 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 org.apache.commons.codec;

/**
* Defines common decoding methods for byte array decoders.
*
* @author Apache Software Foundation
* @version $Id: BinaryDecoder.java,v 1.10 2004/06/15 18:14:15 ggregory Exp $
*/
public interface BinaryDecoder extends Decoder {

/**
* Decodes a byte array and returns the results as a byte array.
*
* @param pArray A byte array which has been encoded with the
* appropriate encoder
*
* @return a byte array that contains decoded content
*
* @throws DecoderException A decoder exception is thrown
* if a Decoder encounters a failure condition during
* the decode process.
*/
byte[] decode(byte[] pArray) throws DecoderException;
}

41 changes: 41 additions & 0 deletions src/org/apache/commons/codec/BinaryEncoder.java
@@ -0,0 +1,41 @@
/*
* 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 org.apache.commons.codec;

/**
* Defines common encoding methods for byte array encoders.
*
* @author Apache Software Foundation
* @version $Id: BinaryEncoder.java,v 1.10 2004/02/29 04:08:31 tobrien Exp $
*/
public interface BinaryEncoder extends Encoder {

/**
* Encodes a byte array and return the encoded data
* as a byte array.
*
* @param pArray Data to be encoded
*
* @return A byte array containing the encoded data
*
* @throws EncoderException thrown if the Encoder
* encounters a failure condition during the
* encoding process.
*/
byte[] encode(byte[] pArray) throws EncoderException;
}

54 changes: 54 additions & 0 deletions src/org/apache/commons/codec/Decoder.java
@@ -0,0 +1,54 @@
/*
* 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 org.apache.commons.codec;

/**
* <p>Provides the highest level of abstraction for Decoders.
* This is the sister interface of {@link Encoder}. All
* Decoders implement this common generic interface.</p>
*
* <p>Allows a user to pass a generic Object to any Decoder
* implementation in the codec package.</p>
*
* <p>One of the two interfaces at the center of the codec package.</p>
*
* @author Apache Software Foundation
* @version $Id: Decoder.java,v 1.9 2004/02/29 04:08:31 tobrien Exp $
*/
public interface Decoder {

/**
* Decodes an "encoded" Object and returns a "decoded"
* Object. Note that the implementation of this
* interface will try to cast the Object parameter
* to the specific type expected by a particular Decoder
* implementation. If a {@link java.lang.ClassCastException} occurs
* this decode method will throw a DecoderException.
*
* @param pObject an object to "decode"
*
* @return a 'decoded" object
*
* @throws DecoderException a decoder exception can
* be thrown for any number of reasons. Some good
* candidates are that the parameter passed to this
* method is null, a param cannot be cast to the
* appropriate type for a specific encoder.
*/
Object decode(Object pObject) throws DecoderException;
}

37 changes: 37 additions & 0 deletions src/org/apache/commons/codec/DecoderException.java
@@ -0,0 +1,37 @@
/*
* 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 org.apache.commons.codec;

/**
* Thrown when a Decoder has encountered a failure condition during a decode.
*
* @author Apache Software Foundation
* @version $Id: DecoderException.java,v 1.9 2004/02/29 04:08:31 tobrien Exp $
*/
public class DecoderException extends Exception {

/**
* Creates a DecoderException
*
* @param pMessage A message with meaning to a human
*/
public DecoderException(String pMessage) {
super(pMessage);
}

}

45 changes: 45 additions & 0 deletions src/org/apache/commons/codec/Encoder.java
@@ -0,0 +1,45 @@
/*
* 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 org.apache.commons.codec;

/**
* <p>Provides the highest level of abstraction for Encoders.
* This is the sister interface of {@link Decoder}. Every implementation of
* Encoder provides this common generic interface whic allows a user to pass a
* generic Object to any Encoder implementation in the codec package.</p>
*
* @author Apache Software Foundation
* @version $Id: Encoder.java,v 1.10 2004/02/29 04:08:31 tobrien Exp $
*/
public interface Encoder {

/**
* Encodes an "Object" and returns the encoded content
* as an Object. The Objects here may just be <code>byte[]</code>
* or <code>String</code>s depending on the implementation used.
*
* @param pObject An object ot encode
*
* @return An "encoded" Object
*
* @throws EncoderException an encoder exception is
* thrown if the encoder experiences a failure
* condition during the encoding process.
*/
Object encode(Object pObject) throws EncoderException;
}

39 changes: 39 additions & 0 deletions src/org/apache/commons/codec/EncoderException.java
@@ -0,0 +1,39 @@
/*
* 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 org.apache.commons.codec;

/**
* Thrown when there is a failure condition during the encoding process. This
* exception is thrown when an Encoder encounters a encoding specific exception
* such as invalid data, inability to calculate a checksum, characters outside of the
* expected range.
*
* @author Apache Software Foundation
* @version $Id: EncoderException.java,v 1.10 2004/02/29 04:08:31 tobrien Exp $
*/
public class EncoderException extends Exception {

/**
* Creates a new instance of this exception with an useful message.
*
* @param pMessage a useful message relating to the encoder specific error.
*/
public EncoderException(String pMessage) {
super(pMessage);
}
}

39 changes: 39 additions & 0 deletions src/org/apache/commons/codec/StringDecoder.java
@@ -0,0 +1,39 @@
/*
* 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 org.apache.commons.codec;

/**
* Decodes a String into a String.
*
* @author Apache Software Foundation
* @version $Id: StringDecoder.java,v 1.9 2004/02/29 04:08:31 tobrien Exp $
*/
public interface StringDecoder extends Decoder {

/**
* Decodes a String and returns a String.
*
* @param pString a String to encode
*
* @return the encoded String
*
* @throws DecoderException thrown if there is
* an error conidition during the Encoding process.
*/
String decode(String pString) throws DecoderException;
}

39 changes: 39 additions & 0 deletions src/org/apache/commons/codec/StringEncoder.java
@@ -0,0 +1,39 @@
/*
* 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 org.apache.commons.codec;

/**
* Encodes a String into a String.
*
* @author Apache Software Foundation
* @version $Id: StringEncoder.java,v 1.9 2004/02/29 04:08:31 tobrien Exp $
*/
public interface StringEncoder extends Encoder {

/**
* Encodes a String and returns a String.
*
* @param pString a String to encode
*
* @return the encoded String
*
* @throws EncoderException thrown if there is
* an error conidition during the Encoding process.
*/
String encode(String pString) throws EncoderException;
}

0 comments on commit 069490a

Please sign in to comment.