Writes a class' bytecode to an <code>OutputStream</code>.
@param cl The <code>Class</code> to write.
@param out The <code>OutputStream</code> to write to.
@throws IOException If unable to write to <code>out</code>.
1063
public static void writeClassToStream(Class<?> cl, OutputStream out) throws IOException {
    InputStream in = getClassAsStream(cl);
    StreamUtil.writeStream(in, out);
    out.flush();
  }
423982
private void writeObject(ObjectOutputStream out) throws IOException {

        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "writeObject: " + this);

        // Use v1 unless features are present that require v2.
        int version = Constants.TIMER_TASK_V1;
        if (parsedSchedule != null) {
            version = Constants.TIMER_TASK_V2;
        }

        out.defaultWriteObject();

        // Write out header information first.
        out.write(EYECATCHER);
        out.writeShort(PLATFORM);
        out.writeShort(version);

        // Write out the instance data.
        out.writeObject(j2eeName.getBytes());
        out.writeObject(userInfoBytes);

        switch (version) {

            case Constants.TIMER_TASK_V1:
                out.writeLong(expiration);
                out.writeLong(interval);
                break;

            case Constants.TIMER_TASK_V2:
                out.writeObject(parsedSchedule);
                out.writeInt(methodId);
                out.writeObject(automaticMethodName);
                out.writeObject(automaticClassName);
                break;

            default:
                // cannot occur since initialize above
                break;
        }

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "writeObject");
    }
89188
public void write(OutputStream out)
         throws IOException
    {
        Writer writer = new OutputStreamWriter(out);
        write(writer);
        writer.flush();
    }
482438
public static void write(ObjectOutput out, java.lang.reflect.Field field) throws IOException {
        if (field == null) {
            ClassRef.write(out, null);
        } else {
            ClassRef.write(out, field.getDeclaringClass());
            out.writeUTF(field.getName());
        }
    }
788634
public void writeTo(OutputStream out) throws IOException
    {
        int sz=size();

        if (sz<=AJP13ResponsePacket.__MAX_BUF)
            super.writeTo(out);
        else
        {
            int offset=preReserve();
            int data=sz-AJP13ResponsePacket.__DATA_HDR;

            while (data>AJP13ResponsePacket.__MAX_DATA)
            {
                _packet.setDataSize(AJP13ResponsePacket.__MAX_BUF-AJP13ResponsePacket.__HDR_SIZE);
                if (offset>0)
                    System.arraycopy(_buf,0,_buf,offset,AJP13ResponsePacket.__DATA_HDR);
                out.write(_buf,offset,AJP13ResponsePacket.__MAX_BUF);

                data-=AJP13ResponsePacket.__MAX_DATA;
                offset+=AJP13ResponsePacket.__MAX_DATA;
            }

            int len=data+AJP13ResponsePacket.__DATA_HDR;
            _packet.setDataSize(len-AJP13ResponsePacket.__HDR_SIZE);
            if (offset>0)
                System.arraycopy(_buf,0,_buf,offset,AJP13ResponsePacket.__DATA_HDR);
            out.write(_buf,offset,len);
        }
    }
1235446
public FileObject write(ClassSymbol c)
        throws IOException
    {
        String className = c.flatName().toString();
        FileObject outFile
            = fileManager.getFileForOutput(StandardLocation.NATIVE_HEADER_OUTPUT,
                "", className.replaceAll("[.$]", "_") + ".h", null);
        Writer out = outFile.openWriter();
        try {
            write(out, c);
            if (verbose)
                log.printVerbose("wrote.file", outFile);
            out.close();
            out = null;
        } finally {
            if (out != null) {
                // if we are propogating an exception, delete the file
                out.close();
                outFile.delete();
                outFile = null;
            }
        }
        return outFile; // may be null if write failed
    }
961730
public void writeObject(Object o) throws IOException {
        ObjectOutputStream oos = AnonymousClassWarnings.checkingObjectOutputStream(out);
        oos.writeObject(o);
        // don't close oss, which will close the underlying stream
        // no need to flush either, given the way oos is implemented
    }
673535
public void writeObject (ObjectOutputStream out)
        throws IOException
    {
        if (!classDefinesElementType()) {
            out.writeUTF(_elementType.getName());
        }
        out.write(_contents);
    }
869903
public void writeTo(OutputStream out) throws IOException {
        out.write(this.content);
        out.flush();
        out.close();
    }
10489
@Override
	public void write(final OutputStream output) throws IOException
	{
		initialize();
		if (content == null)
		{
			content = new byte[0];
		}
		output.write(content, 0, content.length);
		output.flush();
	}
444218
public void writeTo(final OutputStream outputStream) throws IOException {
        outputStream.write(getSigningKey());
        outputStream.write(getEncryptionKey());
    }
418686
public void writeExternal(java.io.ObjectOutput out)
        throws java.io.IOException
    {
        HashMap map = new HashMap(this);
        out.writeObject(map);
    }
686502
private static void writeMember(ObjectOutputStream out, Executable member)
        throws IOException
    {
        if (member == null) {
            out.writeBoolean(false);
            return;
        }
        out.writeBoolean(true);
        if (!(member instanceof Method || member instanceof Constructor))
            throw new IllegalArgumentException("not Method or Constructor");
        out.writeBoolean(member instanceof Method);
        out.writeObject(member.getName());
        out.writeObject(member.getDeclaringClass());
        writeParameters(out, member.getParameterTypes());
    }
1104711
@Override
    public void write(DataOutput out) throws IOException
    {
        addSignatureIfNeed();
        out.writeInt(magic);
        out.writeShort(minor_version);
        out.writeShort(major_version);
        out.writeShort(constant_pool.size()+1);
        for (ConstantInfo ci : constant_pool)
        {
            ci.write(out);
        }
        int modifier = ClassFlags.getModifier(getModifiers());
        modifier |= ClassFlags.ACC_SYNTHETIC | ClassFlags.ACC_PUBLIC | ClassFlags.ACC_SUPER;
        out.writeShort(modifier);
        out.writeShort(this_class);
        out.writeShort(super_class);
        out.writeShort(interfaces.size());
        for (int ii : interfaces)
        {
            out.writeShort(ii);
        }
        out.writeShort(fields.size());
        for (FieldInfo fi : fields)
        {
            fi.write(out);
        }
        out.writeShort(methods.size());
        for (MethodInfo mi : methods)
        {
            mi.write(out);
        }
        out.writeShort(attributes.size());
        for (AttributeInfo ai : attributes)
        {
            ai.write(out);
        }

    }
611221
void write(ByteCodeWriter out)
    throws IOException
  {
    out.write(ConstantPool.CP_LONG);
    out.writeLong(_value);
  }
61296
public Buffer writeTo(OutputStream out, long byteCount) throws IOException {
    if (out == null) throw new IllegalArgumentException("out == null");
    checkOffsetAndCount(size, 0, byteCount);

    Segment s = head;
    while (byteCount > 0) {
      int toCopy = (int) Math.min(byteCount, s.limit - s.pos);
      out.write(s.data, s.pos, toCopy);

      s.pos += toCopy;
      size -= toCopy;
      byteCount -= toCopy;

      if (s.pos == s.limit) {
        Segment toRecycle = s;
        head = s = toRecycle.pop();
        SegmentPool.recycle(toRecycle);
      }
    }

    return this;
  }
696523
public <T extends OutputStream> T write(T os) throws IOException {
        close();

        if (!(this.os instanceof ByteArrayOutputStream))
            throw new IllegalStateException("Cannot write to another target if setOutputStream has been called");
        final byte[] content = ((ByteArrayOutputStream) this.os).toByteArray();

        if (packer != null)
            packer.pack(new JarInputStream(new ByteArrayInputStream(content)), os);
        else
            os.write(content);

        os.close();
        return os;
    }