This ochastrates the output of derived classes to the stream
 It writes any possible reference and sees if the noe is_simple? (see there)
 and calls long / or short_out respectively
504914
def out io ,level
      io.write "&#{@referenced} " if @referenced
      if( is_simple? )
        short_out(io,level)
      else
        long_out(io,level)
      end
    end
1258447
public static void streamOut(OutputStream out, Object object) throws IOException {
        streamOut(out, object, false);
    }
768397
def close_stream(self):
        
        if self.fout:
            fout = self.fout
            fout_fn = self.fout_fn
            self.fout.flush()
            self.fout.close()
            self.fout = None
            self.fout_fn = None
            return fout_fn
173092
def educate stream=$stdout
    width # hack: calculate it now; otherwise we have to be careful not to
          # call this unless the cursor's at the beginning of a line.
    left = {}
    cols = {}
    @specs.each do |name, spec|

      s_type = case spec[:type]
        when :flag; ""
        when :int; " <i>"
        when :ints; " <i+>"
        when :string; " <s>"
        when :strings; " <s+>"
        when :float; " <f>"
        when :floats; " <f+>"
        when :io; " <filename/uri>"
        when :ios; " <filename/uri+>"
        when :date; " <date>"
        when :dates; " <date+>"
      end

      cols[name] = [
        (spec[:short] && spec[:short] != :none ? "-#{spec[:short]}" : ""),
        (spec[:type] == :flag && spec[:default] ? "--#{spec[:long]}; --no-#{spec[:long]}" : "--#{spec[:long]}"),
        (spec[:ex] ? "[#{spec[:ex]}]" : ""),
        s_type
      ]
    end

    widths = (0..3).map {|index|
      cols.max_by{|x| x[1][index].length }[1][index].length
    }
    

    unless @order.size > 0 && @order.first.first == :text
      stream.puts "#@version\n" if @version
      stream.puts "Options:"
    end

    @order.each do |what, opt|
      if what == :text
        stream.puts wrap(opt)
        next
      end

      spec = @specs[opt]
      stream.printf "    %-#{widths[0]+2}s %-#{widths[1]+2}s %#{widths[2]+2}s -  ", *cols[opt]
      desc = spec[:desc] + begin
        default_s = case spec[:default]
        when $stdout; "<stdout>"
        when $stdin; "<stdin>"
        when $stderr; "<stderr>"
        when Array
          spec[:default].join(", ")
        else
          spec[:default].to_s
        end

        if spec[:default]
          if spec[:desc] =~ /\.$/
            " (Default: #{default_s})"
          else
            " (default: #{default_s})"
          end
        else
          ""
        end
      end
      stream.puts wrap(desc)
    end
  end
897772
private static void writeLEShort(OutputStream out, short s) throws IOException {
		out.write((byte)s);
		out.write((byte)((s >> 8) & 0xFF));
	}
87256
public static void dump(final List<Difference> sortedDifferences, final PrintStream out) {
        String currentClassName = "";
        for (final Difference difference : sortedDifferences) {
            if (!currentClassName.equals(difference.getClassName())) {
                out.println("Class "+difference.getClassName());
            }
            out.println(" "+extractActionType(difference)+" "+extractInfoType(difference.getInfo())+" "+extractDetails(difference));
            currentClassName = difference.getClassName();
        }
    }
708310
static void encode(Environment environment, LocalFunctionRegistry registry, Class returnType, Object result, OutputStream output) throws IOException {
        if (ClassUtils.isJavaLangType(returnType)) {
            if (result instanceof Byte) {
                output.write((Byte) result);
            } else if (result instanceof Boolean) {
                output.write(((Boolean) result) ? 1 : 0);
            } else if (result instanceof byte[]) {
                output.write((byte[]) result);
            } else {
                byte[] bytes = environment
                    .convert(result.toString(), byte[].class)
                    .orElseThrow(() -> new InvocationException("Unable to convert result [" + result + "] for output stream"));
                output.write(bytes);
            }
        }
1055488
protected void drain() throws IOException {
        if (primitiveTypes == null || primitiveTypesBuffer == null) {
            return;
        }

        // If we got here we have a Stream previously created
        int offset = 0;
        byte[] written = primitiveTypesBuffer.toByteArray();
        // Normalize the primitive data
        while (offset < written.length) {
            int toWrite = written.length - offset > 1024 ? 1024
                    : written.length - offset;
            if (toWrite < 256) {
                output.writeByte(TC_BLOCKDATA);
                output.writeByte((byte) toWrite);
            } else {
                output.writeByte(TC_BLOCKDATALONG);
                output.writeInt(toWrite);
            }

            // write primitive types we had and the marker of end-of-buffer
            output.write(written, offset, toWrite);
            offset += toWrite;
        }

        // and now we're clean to a state where we can write an object
        primitiveTypes = null;
        primitiveTypesBuffer = null;
    }
638
static void writeShort(OutputStream out, int i) throws IOException {
        out.write((byte)i);
        out.write((byte)(i >> 8));
    }
1112586
void writeTo(OutputStream out) throws IOException {
		//TODO could optimize for aligned instances
		final int size = finish - start;
		final int length = (size + 7) >> 3;
		if (length == 0) return;
		int p = size & 7;
		final int q = finish - p;
		if (p != 0) out.write((byte) getBitsAdj(q, p));
		p = q;
		while (p > start) {
			p -= 8;
			out.write((byte) getBitsAdj(p, 8));
		}
	}
12247
public void writeClassAndObject (Output output, Object object) {
		if (output == null) throw new IllegalArgumentException("output cannot be null.");
		beginObject();
		try {
			if (object == null) {
				writeClass(output, null);
				return;
			}
			Registration registration = writeClass(output, object.getClass());
			if (references && writeReferenceOrNull(output, object, false)) return;
			if (TRACE || (DEBUG && depth == 1)) log("Write", object, output.position());
			registration.getSerializer().write(this, output, object);
		} finally {
			if (--depth == 0 && autoReset) reset();
		}
	}
1161663
@Override
    public void writeExternal(ObjectOutput s) throws IOException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "writeExternal(ObjectOutput)");
        }
        convertBufferIfNeeded();
        super.writeExternal(s);
    }
873317
public static void write(ObjectOutput out, java.lang.reflect.Method meth)
            throws IOException {
        Class cl;

        if (meth == null) {
            ClassRef.write(out, null);
        } else {
            cl = meth.getDeclaringClass();
            ClassRef.write(out, cl);
            out.writeUTF(meth.getName());
            ClassRef.writeClasses(out, meth.getParameterTypes());
        }
    }
818708
@GwtIncompatible("OutputStream")
  static OutputStream asOutputStream(final ByteOutput output) {
    checkNotNull(output);
    return new OutputStream() {
      @Override
      public void write(int b) throws IOException {
        output.write((byte) b);
      }

      @Override
      public void flush() throws IOException {
        output.flush();
      }

      @Override
      public void close() throws IOException {
        output.close();
      }
    };
  }
49179
public void writeObject (Output output, Object object, Serializer serializer) {
		if (output == null) throw new IllegalArgumentException("output cannot be null.");
		if (object == null) throw new IllegalArgumentException("object cannot be null.");
		if (serializer == null) throw new IllegalArgumentException("serializer cannot be null.");
		beginObject();
		try {
			if (references && writeReferenceOrNull(output, object, false)) return;
			if (TRACE || (DEBUG && depth == 1)) log("Write", object, output.position());
			serializer.write(this, output, object);
		} finally {
			if (--depth == 0 && autoReset) reset();
		}
	}
372922
def write(models, out=None, base=None, propertybase=None, shorteners=None, logger=logging):
    '''
    
    '''
    assert out is not None #Output stream required
    if not isinstance(models, list): models = [models]
    shorteners = shorteners or {}

    all_propertybase = [propertybase] if propertybase else []
    all_propertybase.append(VERSA_BASEIRI)

    if any((base, propertybase, shorteners)):
        out.write('# @docheader\n\n* @iri:\n')
    if base:
        out.write('    * @base: {0}'.format(base))
    #for k, v in shorteners:
    #    out.write('    * @base: {0}'.format(base))

    out.write('\n\n')

    origin_space = set()
    #base_out = models[0].base
    for m in models:
        origin_space.update(all_origins(m))

    for o in origin_space:
        out.write('# {0}\n\n'.format(o))
        for o_, r, t, a in m.match(o):
            abbr_r = abbreviate(r, all_propertybase)
            value_format(t)
            out.write('* {0}: {1}\n'.format(abbr_r, value_format(t)))
            for k, v in a.items():
                abbr_k = abbreviate(k, all_propertybase)
                out.write('    * {0}: {1}\n'.format(k, value_format(v)))

        out.write('\n')
    return
345957
public void write(Output dest) throws IOException {
        int i, max;

        dest.writeU2(Access.toFlags(accessFlags));
        dest.writeClassRef(thisClass);
        if (superClass != null) {
            dest.writeClassRef(superClass);
        } else {
            dest.writeU2(0);
        }

        max = interfaces.size();
        dest.writeU2(max);
        for (i = 0; i < max; i++) {
            dest.writeClassRef(interfaces.get(i));
        }
        max = fields.size();
        dest.writeU2(max);
        for (i = 0; i < max; i++) {
            fields.get(i).write(dest);
        }
        max = methods.size();
        dest.writeU2(max);
        for (i = 0; i < max; i++) {
            methods.get(i).write(dest);
        }
        max = attributes.size();
        dest.writeU2(max);
        for (i = 0; i < max; i++) {
            attributes.get(i).write(dest);
        }
    }