Write branch counts.

@param branch the branch
@param out    the out
@throws IOException the io exception
181835
protected void writeBranchCounts(final BranchCounts branch,
    final BitOutputStream out) throws IOException {
    final CodeType currentCodeType = this.getType(branch.path);
    long maximum = branch.size;
    assert maximum >= branch.terminals;
    if (currentCodeType == CodeType.Unknown) {
      this.writeTerminalCount(out, branch.terminals, maximum);
    }
    else if (currentCodeType == CodeType.Terminal) {
      assert branch.size == branch.terminals;
      assert 0 == branch.zeroCount;
      assert 0 == branch.oneCount;
    }
    else assert currentCodeType != CodeType.Prefix || 0 == branch.terminals;
    maximum -= branch.terminals;

    assert maximum >= branch.zeroCount;
    if (0 < maximum) {
      this.writeZeroBranchSize(out, branch.zeroCount, maximum, branch.path);
      maximum -= branch.zeroCount;
    }
    else {
      assert 0 == branch.zeroCount;
    }
    assert maximum == branch.oneCount;
  }
1132974
public void write(byte[]b,int o,int l)
        throws IOException
    {
        _out.write(b,o,l);
    }
483575
public void ifeq(String target) throws IOException
    {
        if (wideIndex)
        {
            out.writeByte(NOT_IFEQ);
            out.writeShort(WIDEFIXOFFSET);
            Branch branch = createBranch(target);
            out.writeByte(GOTO_W);
            out.writeInt(branch);
        }
        else
        {
            Branch branch = createBranch(target);
            out.writeOpCode(IFEQ);
            out.writeShort(branch);
        }
    }
506712
def write_branch_data(self, file):
        
        report = CaseReport(self.case)
        branches = self.case.branches

        col_width   = 8
        col_width_2 = col_width*2+1
        col1_width  = 7

        sep = ("=" * 7 + " ") * 3 + ("=" * col_width + " ") * 6 + "\n"

        file.write(sep)
        # Line one of column headers
        file.write("Name".center(col1_width) + " ")
        file.write("From".center(col1_width) + " ")
        file.write("To".center(col1_width) + " ")
        file.write("From Bus Inj".center(col_width_2) + " ")
        file.write("To Bus Inj".center(col_width_2) + " ")
        file.write("Loss (I^2 * Z)".center(col_width_2) + " ")
        file.write("\n")

        file.write(("-"*col1_width +" ")*3)
        file.write(("-"*col_width_2 +" ")*3 + "\n")

        # Line two of column header
        file.write("..".ljust(col1_width) + " ")
        file.write("Bus".center(col1_width) + " ")
        file.write("Bus".center(col1_width) + " ")
        file.write("P (MW)".center(col_width) + " ")
        file.write("Q (MVAr)".center(col_width) + " ")
        file.write("P (MW)".center(col_width) + " ")
        file.write("Q (MVAr)".center(col_width) + " ")
        file.write("P (MW)".center(col_width) + " ")
        file.write("Q (MVAr)".center(col_width) + " ")
        file.write("\n")

        file.write(sep)
        # Branch rows
        loss = report._loss()
        for each in branches:
            file.write(each.name[:col1_width].ljust(col1_width) + " ")
            file.write(each.from_bus.name[:col1_width].ljust(col1_width)+" ")
            file.write(each.to_bus.name[:col1_width].ljust(col1_width)+" ")
            file.write("%8.2f " % each.p_from)
            file.write("%8.2f " % each.q_from)
            file.write("%8.2f " % each.p_to)
            file.write("%8.2f " % each.q_to)
            file.write("%8.2f " % loss.real[each._i])
            file.write("%8.2f " % loss.imag[each._i])
            file.write("\n")

        # Totals
#        file.write("..".ljust(col1_width) + " ")
#        file.write(("..".ljust(col_width) + " ")*2)
#        file.write(("_"*col_width + " ")*4 + "\n")
        file.write(("..".ljust(col1_width) + " ")*3)
        file.write(("..".ljust(col_width) + " ")*3)
        file.write("*Total:*".rjust(col_width) + " ")
        pl, ql = report.losses
        file.write("%8.2f " % pl)
        file.write("%8.2f " % ql)
        file.write("\n")

        file.write(sep)

        del report
328919
public void write(Writer out)
         throws IOException
    {
        if (reader==null)
            return;
        
        try{
            IO.copy(reader,out);
        }
        finally
        {
            reader.close();
            reader=null;
        }
    }
1205011
void writeBits(ByteBuf out, final int count, final long value) {
        if (count < 0 || count > 32) {
            throw new IllegalArgumentException("count: " + count + " (expected: 0-32)");
        }
        int bitCount = this.bitCount;
        long bitBuffer = this.bitBuffer | value << 64 - count >>> bitCount;
        bitCount += count;

        if (bitCount >= 32) {
            out.writeInt((int) (bitBuffer >>> 32));
            bitBuffer <<= 32;
            bitCount -= 32;
        }
        this.bitBuffer = bitBuffer;
        this.bitCount = bitCount;
    }
694355
void write(ObjectOutputStream out) throws IOException {
        PutField fields = out.putFields();

        fields.put(CONTEXT, threadContextDescriptor.serialize());

        fields.put(EXEC_PROPS, threadContextDescriptor.getExecutionProperties());

        fields.put(INTERNAL_PROP_NAMES, internalPropNames);

        ByteArrayOutputStream bout = new ByteArrayOutputStream();
        ObjectOutputStream oout = new ObjectOutputStream(bout);
        oout.writeObject(object);
        oout.flush();
        fields.put(OBJECT, bout.toByteArray());
        oout.close();

        out.writeFields();
    }
1241083
private void output(File outFile) throws FileNotFoundException {
    System.out.println("Printing to " + outFile.toString());
    PrintStream out = new PrintStream(outFile);
    root.output(out, null);
    out.close();
  }
343744
@Override
    public void write(byte bbuf[], int off, int len) throws IOException {
    	for(OutputStream os : oss) {
    		os.write(bbuf,off,len);
    	}
    }
71217
public void ifle(String target) throws IOException
    {
        if (wideIndex)
        {
            out.writeByte(NOT_IFLE);
            out.writeShort(WIDEFIXOFFSET);
            Branch branch = createBranch(target);
            out.writeByte(GOTO_W);
            out.writeInt(branch);
        }
        else
        {
            Branch branch = createBranch(target);
            out.writeOpCode(IFLE);
            out.writeShort(branch);
        }
    }
972796
public void write(DataOutput out) throws IOException {
    WritableUtils.writeVInt(out, splits.length);
    for (InputSplit s : splits) {
      Text.writeString(out, s.getClass().getName());
    }
    for (InputSplit s : splits) {
      s.write(out);
    }
  }
197175
public void writeObject (ObjectOutputStream out)
        throws IOException
    {
        int ecount = size();
        out.writeInt(ecount);
        for (int ii = 0; ii < ecount; ii++) {
            out.writeObject(get(ii));
        }
    }
443499
public void writeTo(final OutputStream out) throws IOException
	{
		if(out == null) throw new NullPointerException();
		
		final int n = arrays.size();
		for(int k = 0; k < n; k++) {
			byte[] src = (byte[])arrays.get(k);
			out.write(src);
		}
		if(pos > 0) out.write(buffer, 0, pos);
	}
1364955
public void writeExternal(ObjectOutput out) throws IOException {
		if(logger.isDebugEnabled()) {
        	logger.debug("writeExternal - sessionKey=" + sessionKey);
        }

		out.writeObject(sipFactoryImpl);
		if(sessionKey != null) {
			out.writeUTF(sessionKey.toString());
		} else {
			if (null == sipSession) {
				out.writeUTF("");
			} else {
				out.writeUTF(sipSession.getId());
			}
		}
		if(attributes != null && attributes.size() > 0) {
			out.writeInt(attributes.size());
			Object[][] attributesArray = new Object[2][attributes.size()];
			int i = 0;
			for (Entry<String, Object> entry : attributes.entrySet()) {
				attributesArray [0][i] = entry.getKey();
				attributesArray [1][i] = entry.getValue();
				i++;
			}
			out.writeObject(attributesArray);
		} else {
			out.writeInt(0);
		}
		if(transactionApplicationData != null) {
			out.writeBoolean(true);
			out.writeObject(transactionApplicationData);
		} else {
			out.writeBoolean(false);
		}
		out.writeUTF(headerForm.toString());
		if(currentApplicationName != null) {
			out.writeUTF(currentApplicationName);
		} else {
			out.writeUTF("");
		}
		out.writeBoolean(isMessageSent);
		if(ReplicationStrategy.EarlyDialog == StaticServiceHolder.sipStandardService.getReplicationStrategy()) {
			if (logger.isDebugEnabled()) {
				logger.debug("writeExternal transaction = " + transaction);
			}
			if(transaction == null) {
				out.writeUTF("");
			} else {
				if (logger.isDebugEnabled()) {
					logger.debug("writeExternal transactionId = " + transaction.getBranchId() + " transactionType " + (transaction instanceof ServerTransaction));
				}
				out.writeUTF(transaction.getBranchId());
				out.writeBoolean(transaction instanceof ServerTransaction);
			}
		}
		out.writeUTF(message.toString());
	}
923528
public void write(DataOutput out) throws IOException {
    Text.writeString(out, jobFile);
    taskId.write(out);
    out.writeInt(partition);
    out.writeInt(numSlotsRequired);
    taskStatus.write(out);
    skipRanges.write(out);
    out.writeBoolean(skipping);
    out.writeBoolean(jobCleanup);
    if (jobCleanup) {
      WritableUtils.writeEnum(out, jobRunStateForCleanup);
    }
    out.writeBoolean(jobSetup);
    Text.writeString(out, username);
    out.writeBoolean(writeSkipRecs);
    out.writeBoolean(taskCleanup);  
    extraData.write(out);
  }
975834
private static void writeLEInt(OutputStream out, int i) throws IOException {
		out.write((byte)i);
		out.write((byte)((i >> 8) & 0xFF));
		out.write((byte)((i >> 16) & 0xFF));
		out.write((byte)((i >> 24) & 0xFF));
	}
867233
public static <E> void saveCounter(Counter<E> c, OutputStream stream) {
    PrintStream out = new PrintStream(stream);
    for (E key : c.keySet()) {
      out.println(key + " " + c.getCount(key));
    }
  }