/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2006-2009 Sun Microsystems, Inc.
* Portions Copyright 2014-2015 ForgeRock AS.
*/
/**
* This class provides methods for performing base64 encoding and decoding.
* Base64 is a mechanism for encoding binary data in ASCII form by converting
* sets of three bytes with eight significant bits each to sets of four bytes
* with six significant bits each.
*/
mayInstantiate=false,
mayExtend=false,
mayInvoke=true)
public final class Base64
{
/** The set of characters that may be used in base64-encoded values. */
private static final char[] BASE64_ALPHABET =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray();
/** Prevent instance creation. */
private Base64() {
// No implementation required.
}
/**
* Encodes the provided raw data using base64.
*
* @param rawData The raw data to encode. It must not be <CODE>null</CODE>.
*
* @return The base64-encoded representation of the provided raw data.
*/
{
int pos = 0;
for (int i=0; i < iterations; i++)
{
}
{
case 1:
break;
case 2:
break;
}
}
/**
* Encodes the provided raw data using base64.
*
* @param rawData The raw data to encode. It must not be <CODE>null</CODE>.
*
* @return The base64-encoded representation of the provided raw data.
*/
{
int pos = 0;
for (int i=0; i < iterations; i++)
{
}
{
case 1:
break;
case 2:
break;
}
}
/**
* Decodes the provided set of base64-encoded data.
*
* @param encodedData The base64-encoded data to decode. It must not be
* <CODE>null</CODE>.
*
* @return The decoded raw data.
*
* @throws ParseException If a problem occurs while attempting to decode the
* provided data.
*/
throws ParseException
{
// The encoded value must have length that is a multiple of four bytes.
{
}
{
boolean append = true;
int value = 0;
for (int j=0; j < 4; j++)
{
switch (encodedData.charAt(i+j))
{
case 'A':
value <<= 6;
break;
case 'B':
break;
case 'C':
break;
case 'D':
break;
case 'E':
break;
case 'F':
break;
case 'G':
break;
case 'H':
break;
case 'I':
break;
case 'J':
break;
case 'K':
break;
case 'L':
break;
case 'M':
break;
case 'N':
break;
case 'O':
break;
case 'P':
break;
case 'Q':
break;
case 'R':
break;
case 'S':
break;
case 'T':
break;
case 'U':
break;
case 'V':
break;
case 'W':
break;
case 'X':
break;
case 'Y':
break;
case 'Z':
break;
case 'a':
break;
case 'b':
break;
case 'c':
break;
case 'd':
break;
case 'e':
break;
case 'f':
break;
case 'g':
break;
case 'h':
break;
case 'i':
break;
case 'j':
break;
case 'k':
break;
case 'l':
break;
case 'm':
break;
case 'n':
break;
case 'o':
break;
case 'p':
break;
case 'q':
break;
case 'r':
break;
case 's':
break;
case 't':
break;
case 'u':
break;
case 'v':
break;
case 'w':
break;
case 'x':
break;
case 'y':
break;
case 'z':
break;
case '0':
break;
case '1':
break;
case '2':
break;
case '3':
break;
case '4':
break;
case '5':
break;
case '6':
break;
case '7':
break;
case '8':
break;
case '9':
break;
case '+':
break;
case '/':
break;
case '=':
append = false;
switch (j)
{
case 2:
break;
case 3:
break;
}
break;
default:
}
if (! append)
{
break;
}
}
if (append)
{
}
else
{
break;
}
}
return returnArray;
}
/**
* Provide a command-line utility that may be used to base64-encode and
* decode strings and file contents.
*
* @param args The command-line arguments provided to this program.
*/
{
false);
try
{
null,
false, false, true, INFO_PATH_PLACEHOLDER.get(),
false, true, INFO_PATH_PLACEHOLDER.get(),
null,
null,
false, false, true, INFO_PATH_PLACEHOLDER.get(),
}
catch (ArgumentException ae)
{
}
try
{
}
catch (ArgumentException ae)
{
}
if (argParser.isUsageArgumentPresent())
{
if (subCommand == null)
{
}
else
{
}
return;
}
{
// version has already been printed
}
if (subCommand == null)
{
}
{
byte[] dataToEncode = null;
{
try
{
}
catch(UnsupportedEncodingException ex)
{
}
}
else
{
try
{
boolean shouldClose;
{
shouldClose = true;
}
else
{
shouldClose = false;
}
byte[] buffer = new byte[8192];
while (true)
{
if (bytesRead < 0)
{
break;
}
else
{
}
}
if (shouldClose)
{
inputStream.close();
}
}
catch (Exception e)
{
getExceptionMessage(e)));
}
}
if (toEncodedFile.isPresent())
{
try
{
}
catch (Exception e)
{
getExceptionMessage(e)));
}
}
else
{
}
}
{
if (encodedData.isPresent())
{
}
else
{
try
{
boolean shouldClose;
if (encodedFile.isPresent())
{
shouldClose = true;
}
else
{
shouldClose = false;
}
while (true)
{
{
break;
}
while (tokenizer.hasMoreTokens())
{
}
}
if (shouldClose)
{
}
}
catch (Exception e)
{
getExceptionMessage(e)));
}
}
byte[] decodedData = null;
try
{
}
catch (ParseException pe)
{
}
try
{
{
}
else
{
}
}
catch (Exception e)
{
getExceptionMessage(e)));
}
}
else
{
subCommand.getName()));
}
}
}