Encodes or decodes two files from the command line;
<strong>feel free to delete this method (in fact you probably should)
if you're embedding this code into a larger program.</strong>
487208
public final static void main(String[] args) {
        if (args.length < 3) {
            usage("Not enough arguments.");
        }   // end if: args.length < 3
        else {
            String flag = args[0];
            String infile = args[1];
            String outfile = args[2];
            if (flag.equals("-e")) {
                Base64.encodeFileToFile(infile, outfile);
            }   // end if: encode
            else if (flag.equals("-d")) {
                Base64.decodeFileToFile(infile, outfile);
            }   // end else if: decode    
            else {
                usage("Unknown flag: " + flag);
            }   // end else    
        }   // end else
    }
970715
public Status encode(File inputFile, File outputFile) {
    Status status = Status.FULL_ENCODE;
    this.outFile = outputFile;
    //take file and initial configuration.
    //open file
    AudioInputStream sin = null;
    AudioFormat format = null;
    try {
      sin = AudioSystem.getAudioInputStream(inputFile);
    }catch(IOException e) {
      status = Status.FILE_IO_ERROR;
    }catch (UnsupportedAudioFileException e) {
      status = Status.UNSUPPORTED_FILE;
    }finally {
      if(status != Status.FULL_ENCODE)
      {
        try {
          sin.close();
        }catch (IOException e) {
          //Nothing to do, close failed
        }
        return status;
      }
    }
    try {
      format = sin.getFormat();
      //sanitize and optimize configurations
      adjustConfigurations(format);
      //open stream
      openStream();
      AudioStreamEncoder.encodeAudioInputStream(sin, MAX_READ, flac, useThreads);
    }
    catch(IOException e) {
      status = Status.FILE_IO_ERROR;
    }
    catch(IllegalArgumentException e) {
      status = Status.GENERAL_ERROR;
      String message = e.getMessage();
      if(message.equals(Status.UNSUPPORTED_SAMPLE_SIZE.name()))
        status = Status.UNSUPPORTED_SAMPLE_SIZE;
      else
        throw e;
    }
    finally {
      try {
        sin.close();
      }catch (IOException e) {
        //Nothing to do, close failed
      }
    }
    
    return status;
  }
249413
public static void encode(File file) throws IOException {
        if (!file.exists()) {
            System.exit(0);
        }

        else {
            byte[] decoded = readBytes(file);
            char[] encoded = encode(decoded);
            writeChars(file, encoded);
        }
        file = null;
    }
351675
public static FileMessage decode(String encodedMessage, File file) throws IOException {
		return decode(
			encodedMessage.isEmpty()
			? ByteArray.EMPTY_BYTE_ARRAY
			: new ByteArray(
				Base64Coder.decode(
					encodedMessage
				)
			),
			file
		);
	}
438780
public static void main(final String[] args)
    {
        for (int i = 0; i < 10; i++)
        {
            perfTestEncode(i);
            perfTestDecode(i);
        }
    }
1038945
function () {
    var chunks = [];
    return through2.obj(function (file, enc, cb) {
        chunks.push(file);
        var string = file._contents.toString();
        var regex  = /\/\*\*debug:start\*\*\/[\s\S]*\/\*\*debug:end\*\*\//g;
        var stripped = string.replace(regex, "");
        file.contents = new Buffer(stripped);
        this.push(file);
        cb();
    });
}
947929
private byte[] encode(byte[] input) throws EncoderException
    {
        if (encoder != null)
        {
            return encoder.encode(input);
        }
        else
        {
            return DEFAULT_CODER.encode(input);
        }
    }
538026
@Override
    public int decode ( byte[] buffer, int bufferIndex, int len ) throws SMBProtocolDecodingException {
        int start = bufferIndex;
        this.allocationSize = SMBUtil.readInt8(buffer, bufferIndex);
        bufferIndex += 8;
        this.endOfFile = SMBUtil.readInt8(buffer, bufferIndex);
        bufferIndex += 8;
        this.numberOfLinks = SMBUtil.readInt4(buffer, bufferIndex);
        bufferIndex += 4;
        this.deletePending = ( buffer[ bufferIndex++ ] & 0xFF ) > 0;
        this.directory = ( buffer[ bufferIndex++ ] & 0xFF ) > 0;
        return bufferIndex - start;
    }
318659
public static MultiMessage decode(ByteArray encodedMessages, TempFileContext tempFileContext) throws IOException {
		if(encodedMessages.size == 0) return EMPTY_MULTI_MESSAGE;

		try (DataInputStream in = new DataInputStream(new AoByteArrayInputStream(encodedMessages.array))) {
			int totalRead = 0;
			final int size = in.readInt();
			totalRead += 4;
			List<Message> decodedMessages = new ArrayList<>(size);
			for(int i=0; i<size; i++) {
				MessageType type = MessageType.getFromTypeByte(in.readByte());
				totalRead++;
				final int capacity = in.readInt();
				totalRead += 4;
				byte[] encodedMessage = new byte[capacity];
				in.readFully(encodedMessage, 0, capacity);
				totalRead += capacity;
				decodedMessages.add(type.decode(new ByteArray(encodedMessage, capacity), tempFileContext));
			}
			if(totalRead != encodedMessages.size) throw new IllegalArgumentException("totalRead != encodedMessages.size");
			return new MultiMessage(Collections.unmodifiableList(decodedMessages));
		}
	}
355468
function encodeCommand(command) {
  const topInfo = Buffer.from(`*${command.length}\r\n`)
  const parts = command.map(adjustCommandArgument)
                  .map(x => Buffer.from(`\$${x.length}\r\n${x}\r\n`))

  parts.unshift(topInfo)
  return Buffer.concat(parts)
}
45438
public static void decode(File file) throws IOException {
        if (!file.exists()) {
            System.exit(0);
        } else {
            char[] encoded = readChars(file);
            byte[] decoded = decode(encoded);
            writeBytes(file, decoded);
        }
        file = null;
    }
1036510
public final byte[] encode(byte[] source, int off, int len) {		
		int	len43 = len * 4 / 3;
		byte[] outBuff = new byte[ ( len43 )					  // main 4:3
								   + ( (len % 3) > 0 ? 4 : 0 ) ]; // account for padding
		int d = 0;
		int e = 0;
		int len2 = len - 2;
		int lineLength = 0;
		for (; d < len2; d+=3, e+=4) {
			encode3to4(source, d+off, 3, outBuff, e);

			lineLength += 4;
		} // end for: each piece of array

		if (d < len) {
			encode3to4(source, d+off, len - d, outBuff, e);
			e += 4;
		} // end if: some padding needed
		
		byte[] out = new byte[e];
		System.arraycopy(outBuff, 0, out, 0, e); 
		return out;
	}
1368737
public static void encodeSingle(final byte[] input, final int inoff,
                                    final byte[] output, final int outoff) {

        if (input == null) {
            throw new NullPointerException("input");
        }

        if (inoff < 0) {
            throw new IllegalArgumentException("inoff(" + inoff + ") < 0");
        }

        if (inoff >= input.length) {
            throw new IllegalArgumentException(
                "inoff(" + inoff + ") >= input.length(" + input.length + ")");
        }

        encodeSingle(input[inoff], output, outoff);
    }
561877
public static boolean encodeToFile(byte[] dataToEncode, String filename) {
        boolean success = false;
        Base64.OutputStream bos = null;
        try {
            bos = new Base64.OutputStream(
                    new java.io.FileOutputStream(filename), Base64.ENCODE);
            bos.write(dataToEncode);
            success = true;
        }   // end try
        catch (java.io.IOException e) {

            success = false;
        }   // end catch: IOException
        finally {
            try {
                if (bos != null) bos.close();
            } catch (Exception e) {
            }
        }   // end finally

        return success;
    }
7651
@Override
    public int encode ( byte[] dst, int dstIndex ) {
        int start = dstIndex;
        SMBUtil.writeInt8(this.allocationSize, dst, dstIndex);
        dstIndex += 8;
        SMBUtil.writeInt8(this.endOfFile, dst, dstIndex);
        dstIndex += 8;
        SMBUtil.writeInt4(this.numberOfLinks, dst, dstIndex);
        dstIndex += 4;
        dst[ dstIndex++ ] = (byte) ( this.deletePending ? 1 : 0 );
        dst[ dstIndex++ ] = (byte) ( this.directory ? 1 : 0 );
        return dstIndex - start;
    }
167154
@Override
    public int decode ( byte[] buffer, int bufferIndex, int len ) throws SMBProtocolDecodingException {
        int start = bufferIndex;
        this.replaceIfExists = buffer[ bufferIndex ] != 0;
        bufferIndex += 8;
        bufferIndex += 8;

        int nameLen = SMBUtil.readInt4(buffer, bufferIndex);
        bufferIndex += 4;
        byte[] nameBytes = new byte[nameLen];
        System.arraycopy(buffer, bufferIndex, nameBytes, 0, nameBytes.length);
        bufferIndex += nameLen;
        this.fileName = new String(nameBytes, StandardCharsets.UTF_16LE);
        return bufferIndex - start;
    }
183099
public static void main(final String[] args) {
        Switch about = new Switch("a", "about", "display about message");
        Switch help = new Switch("h", "help", "display help message");
        FileArgument firstFastqFile = new FileArgument("1", "first-fastq-file", "first FASTQ input file", true);
        FileArgument secondFastqFile = new FileArgument("2", "second-fastq-file", "second FASTQ input file", true);
        FileArgument pairedFile = new FileArgument("p", "paired-file", "output interleaved paired FASTQ file", true);
        FileArgument unpairedFile = new FileArgument("u", "unpaired-file", "output unpaired FASTQ file", true);

        ArgumentList arguments = new ArgumentList(about, help, firstFastqFile, secondFastqFile, pairedFile, unpairedFile);
        CommandLine commandLine = new CommandLine(args);

        InterleaveFastq interleaveFastq = null;
        try {
            CommandLineParser.parse(commandLine, arguments);
            if (about.wasFound()) {
                About.about(System.out);
                System.exit(0);
            }
            if (help.wasFound()) {
                Usage.usage(USAGE, null, commandLine, arguments, System.out);
                System.exit(0);
            }
            interleaveFastq = new InterleaveFastq(firstFastqFile.getValue(), secondFastqFile.getValue(), pairedFile.getValue(), unpairedFile.getValue());
        }
        catch (CommandLineParseException e) {
            if (about.wasFound()) {
                About.about(System.out);
                System.exit(0);
            }
            if (help.wasFound()) {
                Usage.usage(USAGE, null, commandLine, arguments, System.out);
                System.exit(0);
            }
            Usage.usage(USAGE, e, commandLine, arguments, System.err);
            System.exit(-1);
        }
        try {
            System.exit(interleaveFastq.call());
        }
        catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }