创建`子表4`

@param {Writer} writer 写对象
@param {Array} segments 分块编码列表
@return {Writer}
762699
function writeSubTable4(writer, segments) {

            writer.writeUint16(4); // format
            writer.writeUint16(24 + segments.length * 8); // length
            writer.writeUint16(0); // language

            var segCount = segments.length + 1;
            var maxExponent = Math.floor(Math.log(segCount) / Math.LN2);
            var searchRange = 2 * Math.pow(2, maxExponent);

            writer.writeUint16(segCount * 2); // segCountX2
            writer.writeUint16(searchRange); // searchRange
            writer.writeUint16(maxExponent); // entrySelector
            writer.writeUint16(2 * segCount - searchRange); // rangeShift

            // end list
            segments.forEach(function (segment) {
                writer.writeUint16(segment.end);
            });
            writer.writeUint16(0xFFFF); // end code
            writer.writeUint16(0); // reservedPad


            // start list
            segments.forEach(function (segment) {
                writer.writeUint16(segment.start);
            });
            writer.writeUint16(0xFFFF); // start code

            // id delta
            segments.forEach(function (segment) {
                writer.writeUint16(segment.delta);
            });
            writer.writeUint16(1);

            // Array of range offsets, it doesn't matter when deltas present
            for (var i = 0, l = segments.length; i < l; i++) {
                writer.writeUint16(0);
            }
            writer.writeUint16(0); // rangeOffsetArray should be finished with 0

            return writer;
        }
1158580
function buildHTML(segments) {
		var html = '';
		for (var i=0; i<segments.length; i++) {
			html += buildHTMLForSegment(segments[i]);
		}
		return html;
	}
1372735
private void printNewLine(PrintWriter writer, LineSeparator lineSeparator) {
		if(null == lineSeparator) {
			//默认换行符
			writer.println();
		}else {
			//自定义换行符
			writer.print(lineSeparator.getValue());
		}
	}
743089
function getWriter(input) {
  const writer = input.getWriter();
  const releaseLock = writer.releaseLock;
  writer.releaseLock = () => {
    writer.closed.catch(function() {});
    releaseLock.call(writer);
  };
  return writer;
}
611395
function write(s) {
		var err
		var args = Array.prototype.slice.call(arguments)
		var cb = typeof args[args.length - 1] === 'function' ? args.pop() : null
		var cbCounter = 1
		if (writeToStdoutEnabled) {
			cbCounter++
			process.stdout.write(s, stdWr)
		}
		if (writeStream) {
			cbCounter++
			writeStream.write(s, wRes)
		}
		end()

		function stdWr(e) {
			if (e) {
				if (!err) err = e
				writeToStdoutEnabled = false
				write('stdout error: ' + e.message)
				self.emit('error', e)
			}
			end()
		}

		function wRes(e) {
			if (e) {
				if (!err) err = e
				writeStream = false
				write('stream error: ' + e.message)
				self.emit('error', e)
			}
			end()
		}

		function end() {
			if (!--cbCounter)
				if (cb)
					if (err) cb(err)
					else cb()
		}
	}
37856
public static void toWriter(Node node, Writer writer) throws TransformerException {
		toWriter(node, writer, new HashMap<String, String>());
	}
1092526
function ChunkWriter(chunkRW, options) {
    if (!(this instanceof ChunkWriter)) {
        return new ChunkWriter(chunkRW, options);
    }
    Transform.call(this, options);
    this._writableState.objectMode = true;
    this._readableState.objectMode = false;
    this.chunkRW = chunkRW;
}
210526
public OutSegment openWriter()
  {
    if (isGcRequired()) {
      // _gcSequence = _seqGen.get();
      _table.getGcService().gc(_seqGen.get());
      _seqSinceGcCount = 0;
    }
    
    _seqSinceGcCount++;
    long sequence = _seqGen.get();
    
    return openWriterSeq(sequence);
  }
303464
public static char getChar(MemorySegment[] segments, int offset) {
		if (inFirstSegment(segments, offset, 2)) {
			return segments[0].getChar(offset);
		} else {
			return getCharMultiSegments(segments, offset);
		}
	}
1358351
def get_write_fields(self):
        

        # Record specification fields
        write_fields = self.get_write_subset('record')

        # Segment specification fields are all mandatory
        write_fields = write_fields + ['seg_name', 'seg_len']

        # Comments
        if self.comments !=None:
            write_fields.append('comments')
        return write_fields
418067
function _segment(file) {
  console.log();
  process.stdout.write(util.format('%s ', file));
}
1218659
public static <T> Writer<Params<T>> writer(final Writer<? super T> writer) {
		return elem(
			"params",
			attr("name").map(Params::getName),
			elems("param", writer)
		);
	}
638957
private static BufferedWriter bufferOutput( Writer writer )
    {
        BufferedWriter out;
        if( writer instanceof BufferedWriter )
        {
            out = (BufferedWriter) writer;
        }
        else
        {
            out = new BufferedWriter( writer );
        }
        return out;
    }
1161742
SegmentDescriptor copyTo(Buffer buffer) {
    this.buffer = buffer
      .writeLong(id)
      .writeLong(version)
      .writeLong(index)
      .writeUnsignedInt(maxSegmentSize)
      .writeInt(maxEntries)
      .writeLong(updated)
      .writeBoolean(locked)
      .skip(BYTES - buffer.position())
      .flush();
    return this;
  }
545971
public static int getInt(MemorySegment[] segments, int offset) {
		if (inFirstSegment(segments, offset, 4)) {
			return segments[0].getInt(offset);
		} else {
			return getIntMultiSegments(segments, offset);
		}
	}
125834
function(t) {

            var segments = this.segments;
            var numSegments = segments.length;
            if (numSegments === 0) return null; // if segments is an empty array

            var segmentIndex = t.segmentIndex;
            if (segmentIndex < 0) return segments[0].pointAtT(0);
            if (segmentIndex >= numSegments) return segments[numSegments - 1].pointAtT(1);

            var tValue = t.value;
            if (tValue < 0) tValue = 0;
            else if (tValue > 1) tValue = 1;

            return segments[segmentIndex].pointAtT(tValue);
        }
880552
public void dump(Writer writer) {
        PrintWriter printer = new PrintWriter(writer);
        for (String sectionType : sectionsByType.keySet()) {
            int sectionNumber = 0;
            for (Section section : sectionsByType.get(sectionType)) {
                printer.printf("%s [%d]%n", sectionType, sectionNumber++);
                for (String key : section) {
                    printer.printf(" %30s -> %s%n", key, section.value(key));
                }
            }
            printer.println();
        }
        try {
            writer.flush();
        }
        catch (IOException e) {
            throw new RuntimeException(e);
        }
    }