Write program data.
This is usually used to write to cartridge RAM or mapper registers. Cartridges
don't have mappers by default, but mapperless cartridges can also not be written
to. This method implements the most common mapper register locations.
488145
function( address, value ) {
		if ( address & 0x8000 ) {
			this.writeRegister( address, value );
		} else if ( address >= 0x6000 ) {
			// writing RAM
			this.ramData[ address - 0x6000 ] = value;
		}

		return;
	}
493022
def write_wdata(self, address, register, value):
        
        warnings.warn("write_wdata() is deprecated and will be removed in future versions replace with write_word_data()", DeprecationWarning)
        LOGGER.debug("Writing word data %s to register %s on device %s",
            bin(value), hex(register), hex(address))
        return self.driver.write_word_data(address, register, value)
999500
def write_all(self, data):
        
        self._set_cursor_x(0)
        self._set_cursor_y(0)

        self.DC.on()

        self._write(data)
846004
@Override
  public void write(DataOutput out) throws IOException {
    Text.writeString(out, getHostName());
    out.writeInt(getNumCpu());
    out.writeDouble(getCpuTotalGHz());
    out.writeDouble(getMemTotalGB());
    out.writeDouble(getCpuUsageGHz());
    out.writeDouble(getMemUsageGB());
  }
959087
@Override
    public void writeFile(String arg0, Map result) {

        // Initial variables
        BufferedWriter bwB;                         // output object
        StringBuilder sbData = new StringBuilder(); // construct the data info in the output

        try {

            // Set default value for missing data
            setDefVal();

            // Get version number
            if (dssatVerStr == null) {
                dssatVerStr = getObjectOr(result, "crop_model_version", "").replaceAll("\\D", "");
                if (!dssatVerStr.matches("\\d+")) {
                    dssatVerStr = DssatVersion.DSSAT45.toString();
                }
            }

            // Initial BufferedWriter
            arg0 = revisePath(arg0);
            outputFile = new File(arg0 + "DSSBatch.v" + dssatVerStr);
            bwB = new BufferedWriter(new FileWriter(outputFile));

            // Output Batch File
            // Titel Section
            String crop = getCropName(result);
            String dssatPath = "C:\\DSSAT" + dssatVerStr + "\\";
            String exFileName = getFileName(result, "X");
            int expNo = 1;

            // Write title section
            sbData.append("$BATCH(").append(crop).append(")\r\n!\r\n");
            sbData.append(String.format("! Command Line : %1$sDSCSM0%2$s.EXE B DSSBatch.v%2$s\r\n", dssatPath, dssatVerStr));
            sbData.append("! Crop         : ").append(crop).append("\r\n");
            sbData.append("! Experiment   : ").append(exFileName).append("\r\n");
            sbData.append("! ExpNo        : ").append(expNo).append("\r\n");
            sbData.append(String.format("! Debug        : %1$sDSCSM0%2$s.EXE \" B DSSBatch.v%2$s\"\r\n!\r\n", dssatPath, dssatVerStr));

            // Body Section
            sbData.append("@FILEX                                                                                        TRTNO     RP     SQ     OP     CO\r\n");
            // Get DSSAT Sequence info
            HashMap dssatSeqData = getObjectOr(result, "dssat_sequence", new HashMap());
            ArrayList<HashMap> dssatSeqArr = getObjectOr(dssatSeqData, "data", new ArrayList<HashMap>());
            // If missing, set default value
            if (dssatSeqArr.isEmpty()) {
                HashMap tmp = new HashMap();
                tmp.put("sq", "1");
                tmp.put("op", "1");
                tmp.put("co", "0");
                dssatSeqArr.add(tmp);
            }
            // Output all info
            for (HashMap dssatSeqSubData : dssatSeqArr) {
                sbData.append(String.format("%1$-92s %2$6s %3$6s %4$6s %5$6s %6$6s", exFileName, "1", "1", getObjectOr(dssatSeqSubData, "sq", "1"), getObjectOr(dssatSeqSubData, "op", "1"), getObjectOr(dssatSeqSubData, "co", "0")));
            }

            // Output finish
            bwB.write(sbError.toString());
            bwB.write(sbData.toString());
            bwB.close();
        } catch (IOException e) {
            LOG.error(DssatCommonOutput.getStackTrace(e));
        }
    }
72831
def write(self, session, directory, name, maskMap):
        

        # Assemble Path to file
        name_split = name.split('.')
        name = name_split[0]

        # Default extension
        extension = ''

        if len(name_split) >= 2:
            extension = name_split[-1]

        # Run name preprocessor method if present
        try:
            name = self._namePreprocessor(name)
        except:
            'DO NOTHING'

        if extension == '':
            filename = '{0}.{1}'.format(name, self.fileExtension)
        else:
            filename = '{0}.{1}'.format(name, extension)

        filePath = os.path.join(directory, filename)

        with open(filePath, 'w') as openFile:
            # Write Lines
            self._write(session=session,
                        openFile=openFile,
                        maskMap=maskMap)
1267169
private void writeMapSimple(SerIterator itemIterator) throws IOException {
        StringConverter<Object> keyConverter = settings.getConverter().findConverterNoGenerics(itemIterator.keyType());
        output.writeObjectStart();
        while (itemIterator.hasNext()) {
            itemIterator.next();
            Object key = itemIterator.key();
            if (key == null) {
                throw new IllegalArgumentException("Unable to write map key as it cannot be null");
            }
            String str = keyConverter.convertToString(itemIterator.key());
            if (str == null) {
                throw new IllegalArgumentException("Unable to write map key as it cannot be a null string");
            }
            output.writeObjectKey(str);
            writeObject(itemIterator.valueType(), itemIterator.value(), itemIterator);
        }
        output.writeObjectEnd();
    }
1345053
def write(self, data):
        '''  '''
        if data == '\n':  # print does this
            return self.stream.write(data)
        else:
            bytes_ = 0
            for line in data.splitlines(True):
                nl = ''
                if line.endswith('\n'):  # mv nl to end:
                    line = line[:-1]
                    nl = '\n'
                bytes_ += self.stream.write(
                                f'{self.start}{line}{self.default}{nl}'
                          ) or 0  # in case None returned (on Windows)
            return bytes_
695967
public void write(byte[] buf, int off, int len) throws IOException {
    while (true) {
      lockW.lock();
      try {
        // fail if closed
        checkClosed();
        
        final int lenToWrite = Math.min(len, length - availableCount.get());
        final int lenForward = Math.min(lenToWrite, length - writeCursor);
        final int lenRemaining = lenToWrite - lenForward;
        
        // after writeCursor
        if (lenForward > 0) {
          System.arraycopy(buf, off, bytes, writeCursor, lenForward);
          incWriteCursor(lenForward);
        }
        
        // before writeCursor
        if (lenRemaining > 0) {
          System.arraycopy(buf, off + lenForward, bytes, 0, lenRemaining);
          incWriteCursor(lenRemaining);
        } 
        
        availableCount.addAndGet(lenToWrite);
        totalWritten += lenToWrite;
        
        // modify offset and len for next iteration
        off += lenToWrite;
        len -= lenToWrite;        
        if (len == 0) {
          return;
        }
      } finally {
        lockW.unlock();
      }
      sleep(1);
    }
  }
1280715
private static void writeStringMap(SymbolTable map, ObjectOutput out)
      throws IOException {
    out.writeInt(map.size());
    for (ObjectIntCursor<String> cursor : map) {
      out.writeUTF(cursor.key);
      out.writeInt(cursor.value);
    }
  }
237994
def write(str)
      while !str.empty?
        pre,mid,str = str.partition("\n")
        write_str(pre) unless pre.empty?
        writeln unless mid.empty?
      end
    end
1143624
def _perform_write(self, addr, data):
        """"""
        return self._machine_controller.write(addr, data, self._x, self._y, 0)
553244
private void writeClassData() {
		try (PrintStream out = new PrintStream(openResultFileOuputStream(
				resultDirectory, "classes.json"))) {
			out.println("{");

			// Add direct subclass information:
			for (Entry<Integer, ClassRecord> classEntry : this.classRecords
					.entrySet()) {
				if (classEntry.getValue().subclassCount == 0
						&& classEntry.getValue().itemCount == 0) {
					continue;
				}
				for (Integer superClass : classEntry.getValue().directSuperClasses) {
					this.classRecords.get(superClass).nonemptyDirectSubclasses
							.add(classEntry.getKey().toString());
				}
			}

			int count = 0;
			int countNoLabel = 0;
			for (Entry<Integer, ClassRecord> classEntry : this.classRecords
					.entrySet()) {
				if (classEntry.getValue().subclassCount == 0
						&& classEntry.getValue().itemCount == 0) {
					continue;
				}

				if (classEntry.getValue().label == null) {
					countNoLabel++;
				}

				if (count > 0) {
					out.println(",");
				}
				out.print("\"" + classEntry.getKey() + "\":");
				mapper.writeValue(out, classEntry.getValue());
				count++;
			}
			out.println("\n}");

			System.out.println(" Serialized information for " + count
					+ " class items.");
			System.out.println(" -- class items with missing label: "
					+ countNoLabel);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
1301104
def as_ab_write(self, start, data):
        
        wordlen = snap7.snap7types.S7WLByte
        type_ = snap7.snap7types.wordlen_to_ctypes[wordlen]
        size = len(data)
        cdata = (type_ * size).from_buffer_copy(data)
        logger.debug("ab write: start: %s: size: %s: " % (start, size))
        return self.library.Cli_AsABWrite(
            self.pointer, start, size, byref(cdata))
762252
def write_bytes(self, data: bytes, *, append=True):
        '''  '''
        mode = 'ab' if append else 'wb'
        return self.write(data, mode=mode)
1350165
public boolean writeInputData(Writer wtr) throws Throwable {
    if ((ldifData == null) || (ldifData.size() == 0)) {
      return false;
    }

    synchronized (wtr) {
      for (int i = 0; i < ldifData.size(); i++) {
        String str = (String)ldifData.elementAt(i);

        wtr.write(str);
        wtr.write('\n');
      }

      // terminate with null
      wtr.write('\n');
      wtr.flush();
    }

    return true;
  }
409146
def write(self, addr, data):
        '''

        '''
        self.set_addr(addr & 0xfe)
        self.set_data(data)
        self.set_size(len(data))
        self.start()
        while not self.is_ready:
            pass