Skip to content

Commit 98e7e33

Browse files
committed
some changes
1 parent 6cb3116 commit 98e7e33

File tree

78 files changed

+19872
-46
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+19872
-46
lines changed

libs/gson-2.3.1.jar

-206 KB
Binary file not shown.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.commons.codec;
19+
20+
/**
21+
* Defines common decoding methods for byte array decoders.
22+
*
23+
* @version $Id$
24+
*/
25+
public interface BinaryDecoder extends Decoder {
26+
27+
/**
28+
* Decodes a byte array and returns the results as a byte array.
29+
*
30+
* @param source
31+
* A byte array which has been encoded with the appropriate encoder
32+
* @return a byte array that contains decoded content
33+
* @throws DecoderException
34+
* A decoder exception is thrown if a Decoder encounters a failure condition during the decode process.
35+
*/
36+
byte[] decode(byte[] source) throws DecoderException;
37+
}
38+
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.commons.codec;
19+
20+
/**
21+
* Defines common encoding methods for byte array encoders.
22+
*
23+
* @version $Id$
24+
*/
25+
public interface BinaryEncoder extends Encoder {
26+
27+
/**
28+
* Encodes a byte array and return the encoded data as a byte array.
29+
*
30+
* @param source
31+
* Data to be encoded
32+
* @return A byte array containing the encoded data
33+
* @throws EncoderException
34+
* thrown if the Encoder encounters a failure condition during the encoding process.
35+
*/
36+
byte[] encode(byte[] source) throws EncoderException;
37+
}
38+
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.commons.codec;
19+
20+
/**
21+
* Character encoding names required of every implementation of the Java platform.
22+
*
23+
* From the Java documentation <a
24+
* href="http://download.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>:
25+
* <p>
26+
* <cite>Every implementation of the Java platform is required to support the following character encodings. Consult the
27+
* release documentation for your implementation to see if any other encodings are supported. Consult the release
28+
* documentation for your implementation to see if any other encodings are supported.</cite>
29+
* </p>
30+
*
31+
* <ul>
32+
* <li><code>US-ASCII</code><br>
33+
* Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the Unicode character set.</li>
34+
* <li><code>ISO-8859-1</code><br>
35+
* ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1.</li>
36+
* <li><code>UTF-8</code><br>
37+
* Eight-bit Unicode Transformation Format.</li>
38+
* <li><code>UTF-16BE</code><br>
39+
* Sixteen-bit Unicode Transformation Format, big-endian byte order.</li>
40+
* <li><code>UTF-16LE</code><br>
41+
* Sixteen-bit Unicode Transformation Format, little-endian byte order.</li>
42+
* <li><code>UTF-16</code><br>
43+
* Sixteen-bit Unicode Transformation Format, byte order specified by a mandatory initial byte-order mark (either order
44+
* accepted on input, big-endian used on output.)</li>
45+
* </ul>
46+
*
47+
* This perhaps would best belong in the [lang] project. Even if a similar interface is defined in [lang], it is not
48+
* foreseen that [codec] would be made to depend on [lang].
49+
*
50+
* <p>
51+
* This class is immutable and thread-safe.
52+
* </p>
53+
*
54+
* @see <a href="http://download.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
55+
* @since 1.4
56+
* @version $Id$
57+
*/
58+
public class CharEncoding {
59+
/**
60+
* CharEncodingISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1.
61+
* <p>
62+
* Every implementation of the Java platform is required to support this character encoding.
63+
*
64+
* @see <a href="http://download.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
65+
*/
66+
public static final String ISO_8859_1 = "ISO-8859-1";
67+
68+
/**
69+
* Seven-bit ASCII, also known as ISO646-US, also known as the Basic Latin block of the Unicode character set.
70+
* <p>
71+
* Every implementation of the Java platform is required to support this character encoding.
72+
*
73+
* @see <a href="http://download.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
74+
*/
75+
public static final String US_ASCII = "US-ASCII";
76+
77+
/**
78+
* Sixteen-bit Unicode Transformation Format, The byte order specified by a mandatory initial byte-order mark
79+
* (either order accepted on input, big-endian used on output)
80+
* <p>
81+
* Every implementation of the Java platform is required to support this character encoding.
82+
*
83+
* @see <a href="http://download.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
84+
*/
85+
public static final String UTF_16 = "UTF-16";
86+
87+
/**
88+
* Sixteen-bit Unicode Transformation Format, big-endian byte order.
89+
* <p>
90+
* Every implementation of the Java platform is required to support this character encoding.
91+
*
92+
* @see <a href="http://download.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
93+
*/
94+
public static final String UTF_16BE = "UTF-16BE";
95+
96+
/**
97+
* Sixteen-bit Unicode Transformation Format, little-endian byte order.
98+
* <p>
99+
* Every implementation of the Java platform is required to support this character encoding.
100+
*
101+
* @see <a href="http://download.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
102+
*/
103+
public static final String UTF_16LE = "UTF-16LE";
104+
105+
/**
106+
* Eight-bit Unicode Transformation Format.
107+
* <p>
108+
* Every implementation of the Java platform is required to support this character encoding.
109+
*
110+
* @see <a href="http://download.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
111+
*/
112+
public static final String UTF_8 = "UTF-8";
113+
}
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package org.apache.commons.codec;
18+
19+
import java.nio.charset.Charset;
20+
21+
/**
22+
* Charsets required of every implementation of the Java platform.
23+
*
24+
* From the Java documentation <a href="http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard
25+
* charsets</a>:
26+
* <p>
27+
* <cite>Every implementation of the Java platform is required to support the following character encodings. Consult the
28+
* release documentation for your implementation to see if any other encodings are supported. Consult the release
29+
* documentation for your implementation to see if any other encodings are supported. </cite>
30+
* </p>
31+
*
32+
* <ul>
33+
* <li><code>US-ASCII</code><br>
34+
* Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the Unicode character set.</li>
35+
* <li><code>ISO-8859-1</code><br>
36+
* ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1.</li>
37+
* <li><code>UTF-8</code><br>
38+
* Eight-bit Unicode Transformation Format.</li>
39+
* <li><code>UTF-16BE</code><br>
40+
* Sixteen-bit Unicode Transformation Format, big-endian byte order.</li>
41+
* <li><code>UTF-16LE</code><br>
42+
* Sixteen-bit Unicode Transformation Format, little-endian byte order.</li>
43+
* <li><code>UTF-16</code><br>
44+
* Sixteen-bit Unicode Transformation Format, byte order specified by a mandatory initial byte-order mark (either order
45+
* accepted on input, big-endian used on output.)</li>
46+
* </ul>
47+
*
48+
* This perhaps would best belong in the Commons Lang project. Even if a similar class is defined in Commons Lang, it is
49+
* not foreseen that Commons Codec would be made to depend on Commons Lang.
50+
*
51+
* <p>
52+
* This class is immutable and thread-safe.
53+
* </p>
54+
*
55+
* @see <a href="http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
56+
* @since 1.7
57+
* @version $Id: CharEncoding.java 1173287 2011-09-20 18:16:19Z ggregory $
58+
*/
59+
public class Charsets {
60+
61+
//
62+
// This class should only contain Charset instances for required encodings. This guarantees that it will load
63+
// correctly and without delay on all Java platforms.
64+
//
65+
66+
/**
67+
* Returns the given Charset or the default Charset if the given Charset is null.
68+
*
69+
* @param charset
70+
* A charset or null.
71+
* @return the given Charset or the default Charset if the given Charset is null
72+
*/
73+
public static Charset toCharset(final Charset charset) {
74+
return charset == null ? Charset.defaultCharset() : charset;
75+
}
76+
77+
/**
78+
* Returns a Charset for the named charset. If the name is null, return the default Charset.
79+
*
80+
* @param charset
81+
* The name of the requested charset, may be null.
82+
* @return a Charset for the named charset
83+
* @throws java.nio.charset.UnsupportedCharsetException
84+
* If the named charset is unavailable
85+
*/
86+
public static Charset toCharset(final String charset) {
87+
return charset == null ? Charset.defaultCharset() : Charset.forName(charset);
88+
}
89+
90+
/**
91+
* CharEncodingISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1.
92+
* <p>
93+
* Every implementation of the Java platform is required to support this character encoding.
94+
*
95+
* @see <a href="http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
96+
* @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets.ISO_8859_1} instead
97+
*/
98+
@Deprecated
99+
public static final Charset ISO_8859_1 = Charset.forName(CharEncoding.ISO_8859_1);
100+
101+
/**
102+
* Seven-bit ASCII, also known as ISO646-US, also known as the Basic Latin block of the Unicode character set.
103+
* <p>
104+
* Every implementation of the Java platform is required to support this character encoding.
105+
*
106+
* @see <a href="http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
107+
* @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets.US_ASCII} instead
108+
*/
109+
@Deprecated
110+
public static final Charset US_ASCII = Charset.forName(CharEncoding.US_ASCII);
111+
112+
/**
113+
* Sixteen-bit Unicode Transformation Format, The byte order specified by a mandatory initial byte-order mark
114+
* (either order accepted on input, big-endian used on output)
115+
* <p>
116+
* Every implementation of the Java platform is required to support this character encoding.
117+
*
118+
* @see <a href="http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
119+
* @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets.UTF_16} instead
120+
*/
121+
@Deprecated
122+
public static final Charset UTF_16 = Charset.forName(CharEncoding.UTF_16);
123+
124+
/**
125+
* Sixteen-bit Unicode Transformation Format, big-endian byte order.
126+
* <p>
127+
* Every implementation of the Java platform is required to support this character encoding.
128+
*
129+
* @see <a href="http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
130+
* @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets.UTF_16BE} instead
131+
*/
132+
@Deprecated
133+
public static final Charset UTF_16BE = Charset.forName(CharEncoding.UTF_16BE);
134+
135+
/**
136+
* Sixteen-bit Unicode Transformation Format, little-endian byte order.
137+
* <p>
138+
* Every implementation of the Java platform is required to support this character encoding.
139+
*
140+
* @see <a href="http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
141+
* @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets.UTF_16LE} instead
142+
*/
143+
@Deprecated
144+
public static final Charset UTF_16LE = Charset.forName(CharEncoding.UTF_16LE);
145+
146+
/**
147+
* Eight-bit Unicode Transformation Format.
148+
* <p>
149+
* Every implementation of the Java platform is required to support this character encoding.
150+
*
151+
* @see <a href="http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
152+
* @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets.UTF_8}
153+
*/
154+
@Deprecated
155+
public static final Charset UTF_8 = Charset.forName(CharEncoding.UTF_8);
156+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.commons.codec;
19+
20+
/**
21+
* Provides the highest level of abstraction for Decoders.
22+
* <p>
23+
* This is the sister interface of {@link Encoder}. All Decoders implement this common generic interface.
24+
* Allows a user to pass a generic Object to any Decoder implementation in the codec package.
25+
* <p>
26+
* One of the two interfaces at the center of the codec package.
27+
*
28+
* @version $Id$
29+
*/
30+
public interface Decoder {
31+
32+
/**
33+
* Decodes an "encoded" Object and returns a "decoded" Object. Note that the implementation of this interface will
34+
* try to cast the Object parameter to the specific type expected by a particular Decoder implementation. If a
35+
* {@link ClassCastException} occurs this decode method will throw a DecoderException.
36+
*
37+
* @param source
38+
* the object to decode
39+
* @return a 'decoded" object
40+
* @throws DecoderException
41+
* a decoder exception can be thrown for any number of reasons. Some good candidates are that the
42+
* parameter passed to this method is null, a param cannot be cast to the appropriate type for a
43+
* specific encoder.
44+
*/
45+
Object decode(Object source) throws DecoderException;
46+
}
47+

0 commit comments

Comments
 (0)