Encode raw transaction ouputs.
@param {Array<Output>} outputs
@returns {Buffer} Encoded outputs
@throws {Error}
4219
function encodeOutputs(outputs) {

    //Initialize buffer and offset
    let offset = 0;
    var buffer = Buffer.allocUnsafe(100000);
    //Write number of inputs
    offset += bufferutils.writeVarInt(buffer, outputs.length, offset);

    outputs.forEach((output) => {
        //Write value as 8byte integer
        offset = bufferutils.writeUInt64LE(buffer, output.value, offset);
        //Output script
        if (output.script_type) {
            switch (output.script_type) {
                case 'p2sh':
                    offset = writeScriptPayToScriptHash(output.address, buffer, offset);
                    break;
                case 'pubkeyhash':
                    offset = writeScriptPayToPubKeyHash(output.address, buffer, offset);
                    break;
                case 'lock':
                    let locktime_le_string = parseInt(output.locktime).toString(16).replace(/^(.(..)*)$/, "0$1").match(/../g).reverse().join("");
                    offset = writeScriptLockedPayToPubKeyHash(output.address, locktime_le_string, buffer, offset);
                    break;
                case 'attenuation':
                    let model = Script.deserializeAttenuationModel(output.attenuation.model);
                    if (output.attenuation.height_delta > 0)
                        model = Script.adjustAttenuationModel(model, output.attenuation.height_delta);
                    offset = writeAttenuationScript(Script.serializeAttenuationModel(model), output.attenuation.from_tx, output.attenuation.from_index, output.address, buffer, offset);
                    break;
                default:
                    throw 'Unknown script type: ' + output.script_type;
            }
        } else if (output.script) {
            let script = Script.fromASM(output.script).buffer;
            offset += bufferutils.writeVarInt(buffer, script.length, offset);
            offset += script.copy(buffer, offset);
        } else {
            throw 'Neither script not script type present';
        }

        // attachment
        offset = buffer.writeUInt32LE(output.attachment.version, offset);
        offset = buffer.writeUInt32LE(output.attachment.type, offset);

        if (output.attachment.version === Constants.ATTACHMENT.VERSION.DID) {
            offset += encodeString(buffer, output.attachment.to_did, offset);
            offset += encodeString(buffer, output.attachment.from_did, offset);
        }

        switch (output.attachment.type) {
            case Constants.ATTACHMENT.TYPE.ETP_TRANSFER:
                break;
            case Constants.ATTACHMENT.TYPE.MST:
                switch (output.attachment.status) {
                    case Constants.MST.STATUS.REGISTER:
                        offset = encodeAttachmentAssetIssue(buffer, offset, output.attachment);
                        break;
                    case Constants.MST.STATUS.TRANSFER:
                        offset = encodeAttachmentMSTTransfer(buffer, offset, output.attachment.symbol, output.attachment.quantity);
                        break;
                    default:
                        throw Error("Asset status unknown");
                }
                break;
            case Constants.ATTACHMENT.TYPE.MESSAGE:
                offset = encodeAttachmentMessage(buffer, offset, output.attachment.message);
                break;
            case Constants.ATTACHMENT.TYPE.AVATAR:
                offset = encodeAttachmentDid(buffer, offset, output.attachment);
                break;
            case Constants.ATTACHMENT.TYPE.CERT:
                offset = encodeAttachmentCert(buffer, offset, output.attachment);
                break;
            case Constants.ATTACHMENT.TYPE.MIT:
                switch (output.attachment.status) {
                    case Constants.MIT.STATUS.REGISTER:
                        offset = encodeAttachmentMITRegister(buffer, offset, output.attachment.symbol, output.attachment.content, output.attachment.address);
                        break;
                    case Constants.MIT.STATUS.TRANSFER:
                        offset = encodeAttachmentMITTransfer(buffer, offset, output.attachment.symbol, output.attachment.address);
                        break;
                    default:
                        throw Error("Asset status unknown");
                }
                break;
            default:
                throw Error("What kind of an output is that?!");
        }
    });

    return buffer.slice(0, offset);
}
709806
function amf0Encode(a) {
    var buf = new Buffer(0);
    a.forEach(function (o) {
        buf = Buffer.concat([buf, amf0EncodeOne(o)]);
    });
    return buf;
}
841117
function encode64s(input) {
        var swaps = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"];
        var input_binary = "";
        var output = "";
        var temp_binary;
        var index;
        for (index=0; index < input.length; index++) {
          temp_binary = input.charCodeAt(index).toString(2);
          while (temp_binary.length < 8) {
            temp_binary = "0"+temp_binary;
          }
          input_binary = input_binary + temp_binary;
          while (input_binary.length >= 6) {
            output = output + swaps[parseInt(input_binary.substring(0,6),2)];
            input_binary = input_binary.substring(6);
          }
        }
        if (input_binary.length == 4) {
          temp_binary = input_binary + "00";
          output = output + swaps[parseInt(temp_binary,2)];
          output = output + "=";
        }
        if (input_binary.length == 2) {
          temp_binary = input_binary + "0000";
          output = output + swaps[parseInt(temp_binary,2)];
          output = output + "==";
        }
        return output;
      }
1005685
function (tx) { 
    var outs = [];
    tx.outputs.forEach(function (o) {
      outs.push(new TransactionOutput(o.satoshis,o.script.toBuffer()));
    });
    return outs;
  }
778214
public byte[] encodingToInsertOutput() {
        Transcoding transcoding = lastTranscoding;
        if (transcoding == null) return NULL_STRING;
        Transcoder transcoder = transcoding.transcoder;
        return transcoder.compatibility.isEncoder() ? transcoder.source : transcoder.destination;
    }
464948
function encodeAttachmentMSTTransfer(buffer, offset, symbol, quantity) {
    if (symbol == undefined)
        throw Error('Specify output asset');
    if (quantity == undefined)
        throw Error('Specify output quanity');
    offset = buffer.writeUInt32LE(Constants.MST.STATUS.TRANSFER, offset);
    offset += encodeString(buffer, symbol, offset);
    offset = bufferutils.writeUInt64LE(buffer, quantity, offset);
    return offset;
}
6144
public void encode(OutputStream out) throws IOException {
        // Nothing for default
        if (version == V1) {
            return;
        }
        DerOutputStream tmp = new DerOutputStream();
        tmp.putInteger(version);

        DerOutputStream seq = new DerOutputStream();
        seq.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0),
                  tmp);

        out.write(seq.toByteArray());
    }
736563
function getRowBytesFromTransactionBase64(base64Data) {
  let bytesDecode = base64DecodeFromString(base64Data);
  let transaction = proto.protocol.Transaction.deserializeBinary(bytesDecode);
  let raw = transaction.getRawData();
  return raw.serializeBinary();
}
45560
function encode(data) {
  var encodedData = null;
  try {
    encodedData = JSON.stringify(data);
  } catch (err) {
    logger.warn('failed encoding data', data);
  }
  return encodedData;
}
75579
function encodeNavigation(output) {
    var book = output.getBook();
    var pages = output.getPages();
    var summary = book.getSummary();
    var articles = summary.getArticlesAsList();


    var navigation = articles
        .map(function(article, i) {
            var ref = article.getRef();
            if (!ref) {
                return undefined;
            }

            var prev = articles.get(i - 1);
            var next = articles.get(i + 1);

            return [
                ref,
                {
                    index: i,
                    title: article.getTitle(),
                    introduction: (i === 0),
                    prev: prev? encodeArticle(pages, prev) : undefined,
                    next: next? encodeArticle(pages, next) : undefined,
                    level: article.getLevel()
                }
            ];
        })
        .filter(function(e) {
            return Boolean(e);
        });

    return Immutable.Map(navigation).toJS();
}
1353059
function formatFileOutput(mappings, type) {
  var string = JSON.stringify(mappings, null, 2);
  if (type === '.js') {
    return 'module.exports=' + string;
  } else if (type === '.json') {
    return string;
  }
}
592252
function encodeOutputToJson(output) {
    var book = output.getBook();
    var generator = output.getGenerator();
    var options = output.getOptions();

    var result = encodeBook(book);

    result.output = {
        name: generator
    };

    result.options = options.toJS();

    return result;
}
114168
static private void encodeBytes(byte previous, byte current, int byteIndex, StringBuilder output) {
        int chunk;
        int offset = byteIndex % 5;
        switch (offset) {
            case 0:
                chunk = ((current & 0xF8) >>> 3);
                output.append(lookupTable.charAt(chunk));
                break;
            case 1:
                chunk = (((previous & 0x07) << 2) | ((current & 0xC0) >>> 6));
                output.append(lookupTable.charAt(chunk));
                chunk = ((current & 0x3E) >>> 1);
                output.append(lookupTable.charAt(chunk));
                break;
            case 2:
                chunk = (((previous & 0x01) << 4) | ((current & 0xF0) >>> 4));
                output.append(lookupTable.charAt(chunk));
                break;
            case 3:
                chunk = (((previous & 0x0F) << 1) | ((current & 0x80) >>> 7));
                output.append(lookupTable.charAt(chunk));
                chunk = ((current & 0x7C) >>> 2);
                output.append(lookupTable.charAt(chunk));
                break;
            case 4:
                chunk = (((previous & 0x03) << 3) | ((current & 0xE0) >>> 5));
                output.append(lookupTable.charAt(chunk));
                chunk = (current & 0x1F);
                output.append(lookupTable.charAt(chunk));
                break;
        }
    }
39143
function encodeBuffer(packet, supportsBinary, callback) {
  if (!supportsBinary) {
    return exports.encodeBase64Packet(packet, callback);
  }

  var data = packet.data;
  var typeBuffer = new Buffer(1);
  typeBuffer[0] = packets[packet.type];
  return callback(Buffer.concat([typeBuffer, data]));
}
700987
def encode(raw):
    """"""
    return raw \
        .replace(bytes([SLIP_ESC]), bytes([SLIP_ESC, SLIP_ESC_ESC])) \
        .replace(bytes([SLIP_END]), bytes([SLIP_ESC, SLIP_ESC_END]))
1087813
function parseOutput(output) {
  if (!output) {
    throw new Error('Expected JSON output');
  }

  let info;
  try {
    info = JSON.parse(String(output));
  } catch (err) {
    throw new Error('Failed to parse output as JSON: ' + output);
  }
  if (!Array.isArray(info.symbols)) {
    throw new Error('Expected symbols array: ' + output);
  }
  if (!Array.isArray(info.defines)) {
    throw new Error('Expected defines array: ' + output);
  }

  return info;
}
74168
function encode(arr, buf) {
  assert(Array.isArray(arr), 'array expected');
  buf = buf || new Buffer(0);
  buf = _arr(buf, arr);
  return buf;
}