/* (non-Javadoc)
@see tuwien.auto.calimero.process.ProcessCommunicator#write
(tuwien.auto.calimero.GroupAddress, java.lang.String)
182679
public void write(GroupAddress dst, String value) throws KNXTimeoutException,
		KNXFormatException, KNXLinkClosedException
	{
		final DPTXlatorString t = new DPTXlatorString(DPTXlatorString.DPT_STRING_8859_1);
		t.setValue(value);
		write(dst, priority, t);
	}
729828
@Override
  public final void write(final Map<String, Object> pAddParam, final T pObject,
    final Object pFieldVal, final String pFieldName) throws Exception {
    Method fldSetter = this.settersMap.get(pFieldName);
    fldSetter.invoke(pObject, pFieldVal);
  }
384467
public void write(JsonGenerator jsonGenerator) throws IOException {
    jsonGenerator.writeStartObject();

    // clusterNodeInfo begins
    jsonGenerator.writeFieldName("clusterNodeInfo");
    jsonGenerator.writeStartObject();
    jsonGenerator.writeStringField("name", clusterNodeInfo.name);
    jsonGenerator.writeObjectField("address", clusterNodeInfo.address);
    jsonGenerator.writeObjectField("total", clusterNodeInfo.total);
    jsonGenerator.writeObjectField("free", clusterNodeInfo.free);
    jsonGenerator.writeObjectField("resourceInfos",
      clusterNodeInfo.resourceInfos);
    jsonGenerator.writeEndObject();
    // clusterNodeInfo ends

    // grants begins
    jsonGenerator.writeFieldName("grants");
    jsonGenerator.writeStartObject();
    for (Map.Entry<GrantId, ResourceRequestInfo> entry : grants.entrySet()) {
      jsonGenerator.writeFieldName(entry.getKey().unique);
      jsonGenerator.writeStartObject();
      jsonGenerator.writeFieldName("grantId");
      entry.getKey().write(jsonGenerator);
      jsonGenerator.writeFieldName("grant");
      entry.getValue().write(jsonGenerator);
      jsonGenerator.writeEndObject();
    }
    jsonGenerator.writeEndObject();
    // grants ends

    jsonGenerator.writeEndObject();
    // We skip the hostNode and lastHeartbeatTime as they need not be persisted.
    // resourceTypeToMaxCpu and resourceTypeToStatsMap can be rebuilt using the
    // conf and the grants respectively.
  }
187758
@Override
  public void write(JsonWriterImpl out, ZonedDateTime value)
  {
    out.write(value.format(_formatter));
  }
693362
public void write(JsonGenerator jsonGenerator) throws IOException {
    jsonGenerator.writeStartObject();

    int totalSessionsToCtx = 0, totalDeletedSessions = 0;
    for (int i = 0; i < numNotifierThreads; i++) {
      totalSessionsToCtx += notifierThreads[i].sessionsToCtx.size();
      totalDeletedSessions += notifierThreads[i].deletedSessions.size();
    }

    jsonGenerator.writeNumberField("totalSessionsToCtx",
                                    totalSessionsToCtx);

    jsonGenerator.writeFieldName("sessionsToCtx");
    jsonGenerator.writeStartObject();
    for (int i = 0; i < numNotifierThreads; i++) {
      for (ConcurrentMap.Entry<String, SessionNotificationCtx> entry :
        notifierThreads[i].sessionsToCtx.entrySet()) {
        jsonGenerator.writeFieldName(entry.getKey());
        entry.getValue().write(jsonGenerator);
      }
    }
    jsonGenerator.writeEndObject();

    jsonGenerator.writeNumberField("totalDeletedSessions",
                                    totalDeletedSessions);

    jsonGenerator.writeFieldName("deletedSessions");
    jsonGenerator.writeStartArray();
    for (int i = 0; i < numNotifierThreads; i++) {
      for (String deletedSessionHandle :
            notifierThreads[i].deletedSessions.keySet()) {
        jsonGenerator.writeString(deletedSessionHandle);
      }
    }
    jsonGenerator.writeEndArray();

    jsonGenerator.writeEndObject();
  }
372476
def write(self, group_id, handle):
        '''
        '''
        name = self.name.encode('utf-8')
        desc = self.desc.encode('utf-8')
        handle.write(struct.pack('bb', len(name), -group_id))
        handle.write(name)
        handle.write(struct.pack('<h', 3 + len(desc)))
        handle.write(struct.pack('B', len(desc)))
        handle.write(desc)
        for param in self.params.values():
            param.write(group_id, handle)
1296608
public void write(GroupAddress dst, boolean control, byte stepcode)
		throws KNXTimeoutException, KNXFormatException, KNXLinkClosedException
	{
		final DPTXlator3BitControlled t =
			new DPTXlator3BitControlled(DPTXlator3BitControlled.DPT_CONTROL_DIMMING);
		t.setValue(control, stepcode);
		write(dst, priority, t);
	}
986147
@Override
  public void write(DataOutput out) throws IOException {
    Text.writeString(out, getJobId());
    out.writeDouble(getCpuUsageGHz());
    out.writeDouble(getMemUsageGB());
  }
1216919
def group_write(self, addr, data, dptsize=0):
        
        cemi = CEMIMessage()
        cemi.init_group_write(addr, data, dptsize)

        with self._lock:
            self.send_tunnelling_request(cemi)
            # Workaround for lost KNX packets
            if self._write_delay: 
                time.sleep(self._write_delay)
460670
@Override
    public void write(IChemObject object) throws CDKException {
        if (!(object instanceof IRGroupQuery)) {
            throw new CDKException("Only IRGroupQuery input is accepted.");
        }
        try {

            IRGroupQuery rGroupQuery = (IRGroupQuery) object;
            String now = new SimpleDateFormat("MMddyyHHmm").format(System.currentTimeMillis());
            IAtomContainer rootAtc = rGroupQuery.getRootStructure();

            //Construct header
            StringBuffer rootBlock = new StringBuffer();
            String header = "$MDL  REV  1   " + now + LSEP + "$MOL" + LSEP + "$HDR" + LSEP
                    + "  Rgroup query file (RGFile)" + LSEP + "  CDK    " + now + "2D" + LSEP + LSEP + "$END HDR"
                    + LSEP + "$CTAB";
            rootBlock.append(header).append(LSEP);

            //Construct the root structure, the scaffold
            String rootCTAB = getCTAB(rootAtc);
            rootCTAB = rootCTAB.replaceAll(LSEP + "M  END" + LSEP, "");
            rootBlock.append(rootCTAB).append(LSEP);

            //Write the root's LOG lines
            for (Integer rgrpNum : rGroupQuery.getRGroupDefinitions().keySet()) {
                RGroupList rgList = rGroupQuery.getRGroupDefinitions().get(rgrpNum);
                int restH = rgList.isRestH() ? 1 : 0;
                String logLine = "M  LOG" + MDLV2000Writer.formatMDLInt(1, 3) + MDLV2000Writer.formatMDLInt(rgrpNum, 4)
                        + MDLV2000Writer.formatMDLInt(rgList.getRequiredRGroupNumber(), 4)
                        + MDLV2000Writer.formatMDLInt(restH, 4) + "   " + rgList.getOccurrence();
                rootBlock.append(logLine).append(LSEP);
            }

            //AAL lines are optional, they are needed for R-atoms with multiple bonds to the root
            //for which the order of the attachment points can not be implicitly derived
            //from the order in the atom block. See CT spec for more on that.
            for (IAtom rgroupAtom : rGroupQuery.getRootAttachmentPoints().keySet()) {
                Map<Integer, IBond> rApo = rGroupQuery.getRootAttachmentPoints().get(rgroupAtom);
                if (rApo.size() > 1) {
                    int prevPos = -1;
                    int apoIdx = 1;
                    boolean implicitlyOrdered = true;
                    while (rApo.get(apoIdx) != null && implicitlyOrdered) {
                        IAtom partner = rApo.get(apoIdx).getOther(rgroupAtom);
                        for (int atIdx = 0; atIdx < rootAtc.getAtomCount(); atIdx++) {
                            if (rootAtc.getAtom(atIdx).equals(partner)) {
                                if (atIdx < prevPos) implicitlyOrdered = false;
                                prevPos = atIdx;
                                break;
                            }
                        }
                        apoIdx++;
                    }
                    if (!implicitlyOrdered) {
                        StringBuffer aalLine = new StringBuffer("M  AAL");
                        for (int atIdx = 0; atIdx < rootAtc.getAtomCount(); atIdx++) {
                            if (rootAtc.getAtom(atIdx).equals(rgroupAtom)) {
                                aalLine.append(MDLV2000Writer.formatMDLInt((atIdx + 1), 4));
                                aalLine.append(MDLV2000Writer.formatMDLInt(rApo.size(), 3));

                                apoIdx = 1;
                                while (rApo.get(apoIdx) != null) {
                                    IAtom partner = rApo.get(apoIdx).getOther(rgroupAtom);

                                    for (int a = 0; a < rootAtc.getAtomCount(); a++) {
                                        if (rootAtc.getAtom(a).equals(partner)) {
                                            aalLine.append(MDLV2000Writer.formatMDLInt(a + 1, 4));
                                            aalLine.append(MDLV2000Writer.formatMDLInt(apoIdx, 4));
                                        }
                                    }
                                    apoIdx++;
                                }
                            }
                        }
                        rootBlock.append(aalLine.toString()).append(LSEP);
                    }
                }
            }

            rootBlock.append("M  END").append(LSEP).append("$END CTAB").append(LSEP);

            //Construct each R-group block
            StringBuffer rgpBlock = new StringBuffer();
            for (Integer rgrpNum : rGroupQuery.getRGroupDefinitions().keySet()) {
                List<RGroup> rgrpList = rGroupQuery.getRGroupDefinitions().get(rgrpNum).getRGroups();
                if (rgrpList != null && rgrpList.size() != 0) {
                    rgpBlock.append("$RGP").append(LSEP);;
                    rgpBlock.append(MDLV2000Writer.formatMDLInt(rgrpNum, 4)).append(LSEP);

                    for (RGroup rgroup : rgrpList) {
                        //CTAB block
                        rgpBlock.append("$CTAB").append(LSEP);
                        String ctab = getCTAB(rgroup.getGroup());
                        ctab = ctab.replaceAll(LSEP + "M  END" + LSEP, "");
                        rgpBlock.append(ctab).append(LSEP);

                        //The APO line
                        IAtom firstAttachmentPoint = rgroup.getFirstAttachmentPoint();
                        IAtom secondAttachmentPoint = rgroup.getSecondAttachmentPoint();
                        int apoCount = 0;
                        if (firstAttachmentPoint != null) {
                            StringBuffer apoLine = new StringBuffer();
                            for (int atIdx = 0; atIdx < rgroup.getGroup().getAtomCount(); atIdx++) {
                                if (rgroup.getGroup().getAtom(atIdx).equals(firstAttachmentPoint)) {
                                    apoLine.append(MDLV2000Writer.formatMDLInt((atIdx + 1), 4));
                                    apoCount++;
                                    if (secondAttachmentPoint != null
                                            && secondAttachmentPoint.equals(firstAttachmentPoint)) {
                                        apoLine.append(MDLV2000Writer.formatMDLInt(3, 4));
                                    } else {
                                        apoLine.append(MDLV2000Writer.formatMDLInt(1, 4));
                                    }
                                }
                            }
                            if (secondAttachmentPoint != null && !secondAttachmentPoint.equals(firstAttachmentPoint)) {
                                for (int atIdx = 0; atIdx < rgroup.getGroup().getAtomCount(); atIdx++) {
                                    if (rgroup.getGroup().getAtom(atIdx).equals(secondAttachmentPoint)) {
                                        apoCount++;
                                        apoLine.append(MDLV2000Writer.formatMDLInt((atIdx + 1), 4));
                                        apoLine.append(MDLV2000Writer.formatMDLInt(2, 4));
                                    }
                                }
                            }
                            if (apoCount > 0) {
                                apoLine.insert(0, "M  APO" + MDLV2000Writer.formatMDLInt(apoCount, 3));
                                rgpBlock.append(apoLine).append(LSEP);
                            }
                        }

                        rgpBlock.append("M  END").append(LSEP);
                        rgpBlock.append("$END CTAB").append(LSEP);
                    }
                    rgpBlock.append("$END RGP").append(LSEP);
                }
            }
            rgpBlock.append("$END MOL").append(LSEP);

            writer.write(rootBlock.toString());
            writer.write(rgpBlock.toString());
            writer.flush();

        } catch (IOException e) {
            e.printStackTrace();
            throw new CDKException("Unexpected exception when writing RGFile" + LSEP + e.getMessage());
        }

    }
532928
public void write(PrintWriter out, boolean includeDoc) {
        // getValue() will update the timestamp (if relevant)
        T localValue = getValue();
        if (includeDoc) {
            out.println();
            Long lastUpdate = getLastUpdated();
            if (hasDoc() || lastUpdate != null) {
                out.print("# ");
                if (hasDoc()) {
                    out.print(makePropertiesSafe(getDoc(), null));
                }
                if (lastUpdate != null) {
                    out.print(" (last update: " + lastUpdate + ")");
                }
                out.println();
            }
        }
        out.println(toString());
    }
252154
protected void write(JsonWriter out, T value, TypeAdapter<JsonElement> elementAdapter, TypeAdapter<T> delegate) throws IOException {
        JsonElement tree = delegate.toJsonTree(value);
        beforeWrite(value, tree);
        elementAdapter.write(out, tree);
    }
917014
public static void write(DataOutput out,
                           String username, 
                           String groupname,
                           FsPermission permission) throws IOException {
    Text.writeStringOpt(out, username);
    Text.writeStringOpt(out, groupname);
    permission.write(out);
  }
193094
public void writeRawMessageSetExtension(final int fieldNumber,
                                          final ByteString value)
                                          throws IOException {
    writeTag(WireFormat.MESSAGE_SET_ITEM, WireFormat.WIRETYPE_START_GROUP);
    writeUInt32(WireFormat.MESSAGE_SET_TYPE_ID, fieldNumber);
    writeBytes(WireFormat.MESSAGE_SET_MESSAGE, value);
    writeTag(WireFormat.MESSAGE_SET_ITEM, WireFormat.WIRETYPE_END_GROUP);
  }
1336822
public void write(GroupAddress dst, float value) throws KNXTimeoutException,
		KNXFormatException, KNXLinkClosedException
	{
		final DPTXlator2ByteFloat t =
			new DPTXlator2ByteFloat(DPTXlator2ByteFloat.DPT_TEMPERATURE_DIFFERENCE);
		t.setValue(value);
		write(dst, priority, t);
	}
858382
@Override
	public void write(final String string, final int off, final int len) {
		for (int i = off; i < off + len; i++) {
			write(string.charAt(i));
		}
	}
1012472
public void write(final byte[] src)
	{
		if(src == null) throw new NullPointerException();

		if(src.length < buffer.length - pos) {
			System.arraycopy(src, 0, buffer, pos, src.length);
			pos += src.length;
			size += src.length;
			return;
		}
		writeLoop(src, 0, src.length);
	}