Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
Apache Ant Source Code Files
Apache Ant Source Code Files are inside the Apache Ant source package file like apache-ant-1.10.10-src.zip. Unzip the source package file and go to the "src/main" sub-directory, you will see source code files.
Here is the list of Java source code files of the Apache Ant 1.10.10 in \Users\fyicenter\apache-ant-1.10.10\src\main:
✍: FYIcenter.com
⏎ org/apache/tools/ant/util/Base64Converter.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You 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 * * https://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.tools.ant.util; /** * BASE 64 encoding of a String or an array of bytes. * * Based on RFC 1421. * **/ public class Base64Converter { private static final int BYTE = 8; private static final int WORD = 16; private static final int BYTE_MASK = 0xFF; private static final int POS_0_MASK = 0x0000003F; private static final int POS_1_MASK = 0x00000FC0; private static final int POS_1_SHIFT = 6; private static final int POS_2_MASK = 0x0003F000; private static final int POS_2_SHIFT = 12; private static final int POS_3_MASK = 0x00FC0000; private static final int POS_3_SHIFT = 18; private static final char[] ALPHABET = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', // 0 to 7 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', // 8 to 15 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', // 16 to 23 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', // 24 to 31 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', // 32 to 39 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', // 40 to 47 'w', 'x', 'y', 'z', '0', '1', '2', '3', // 48 to 55 '4', '5', '6', '7', '8', '9', '+', '/'}; // 56 to 63 // CheckStyle:ConstantNameCheck OFF - bc /** Provided for BC purposes */ public static final char[] alphabet = ALPHABET; //NOSONAR // CheckStyle:ConstantNameCheck ON /** * Encode a string into base64 encoding. * @param s the string to encode. * @return the encoded string. */ public String encode(String s) { return encode(s.getBytes()); } /** * Encode a byte array into base64 encoding. * @param octetString the byte array to encode. * @return the encoded string. */ public String encode(byte[] octetString) { int bits24; int bits6; // CheckStyle:MagicNumber OFF char[] out = new char[((octetString.length - 1) / 3 + 1) * 4]; // CheckStyle:MagicNumber ON int outIndex = 0; int i = 0; // CheckStyle:MagicNumber OFF while ((i + 3) <= octetString.length) { // CheckStyle:MagicNumber ON // store the octets bits24 = (octetString[i++] & BYTE_MASK) << WORD; bits24 |= (octetString[i++] & BYTE_MASK) << BYTE; bits24 |= octetString[i++] & BYTE_MASK; bits6 = (bits24 & POS_3_MASK) >> POS_3_SHIFT; out[outIndex++] = ALPHABET[bits6]; bits6 = (bits24 & POS_2_MASK) >> POS_2_SHIFT; out[outIndex++] = ALPHABET[bits6]; bits6 = (bits24 & POS_1_MASK) >> POS_1_SHIFT; out[outIndex++] = ALPHABET[bits6]; bits6 = (bits24 & POS_0_MASK); out[outIndex++] = ALPHABET[bits6]; } if (octetString.length - i == 2) { // store the octets bits24 = (octetString[i] & BYTE_MASK) << WORD; bits24 |= (octetString[i + 1] & BYTE_MASK) << BYTE; bits6 = (bits24 & POS_3_MASK) >> POS_3_SHIFT; out[outIndex++] = ALPHABET[bits6]; bits6 = (bits24 & POS_2_MASK) >> POS_2_SHIFT; out[outIndex++] = ALPHABET[bits6]; bits6 = (bits24 & POS_1_MASK) >> POS_1_SHIFT; out[outIndex++] = ALPHABET[bits6]; // padding out[outIndex++] = '='; } else if (octetString.length - i == 1) { // store the octets bits24 = (octetString[i] & BYTE_MASK) << WORD; bits6 = (bits24 & POS_3_MASK) >> POS_3_SHIFT; out[outIndex++] = ALPHABET[bits6]; bits6 = (bits24 & POS_2_MASK) >> POS_2_SHIFT; out[outIndex++] = ALPHABET[bits6]; // padding out[outIndex++] = '='; out[outIndex++] = '='; } return new String(out); } }
⏎ org/apache/tools/ant/util/Base64Converter.java
Or download all of them as a single archive file:
File name: apache-ant-1.10.10-fyi.zip File size: 2392938 bytes Release date: 2021-04-17 Download
⇐ Download Apache Ant Source Package
2021-07-10, 111029👍, 0💬
Popular Posts:
Java Advanced Imaging (JAI) is a Java platform extension API that provides a set of object-oriented ...
Jettison is a collection of Java APIs (like STaX and DOM) which read and write JSON. This allows nea...
Swingx is the SwingLabs Swing Component Extensions. JAR File Size and Download Location: File name: ...
How to run "jarsigner" command from JDK tools.jar file? "jarsigner" command allows you to digitally ...
GJT (Giant Java Tree) implementation of XML Pull Parser. JAR File Size and Download Location: File n...