当前位置: 首页>>代码示例>>Java>>正文


Java WriteStream.write方法代码示例

本文整理汇总了Java中io.vertx.core.streams.WriteStream.write方法的典型用法代码示例。如果您正苦于以下问题:Java WriteStream.write方法的具体用法?Java WriteStream.write怎么用?Java WriteStream.write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.vertx.core.streams.WriteStream的用法示例。


在下文中一共展示了WriteStream.write方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: finish

import io.vertx.core.streams.WriteStream; //导入方法依赖的package包/类
@Override
public void finish(WriteStream<Buffer> out) {
  // close all parent elements
  for (int i = parents.size() - 1; i >= 0; --i) {
    XMLStartElement e = parents.get(i);
    out.write(Buffer.buffer("</" + e.getName() + ">"));
  }
}
 
开发者ID:georocket,项目名称:georocket,代码行数:9,代码来源:AbstractMergeStrategy.java

示例2: writeHeader

import io.vertx.core.streams.WriteStream; //导入方法依赖的package包/类
/**
 * Write the header
 * @param out the output stream to write to
 */
private void writeHeader(WriteStream<Buffer> out) {
  if (mergedType == FEATURE_COLLECTION) {
    out.write(Buffer.buffer("{\"type\":\"FeatureCollection\",\"features\":["));
  } else if (mergedType == GEOMETRY_COLLECTION) {
    out.write(Buffer.buffer("{\"type\":\"GeometryCollection\",\"geometries\":["));
  }
}
 
开发者ID:georocket,项目名称:georocket,代码行数:12,代码来源:GeoJsonMerger.java

示例3: merge

import io.vertx.core.streams.WriteStream; //导入方法依赖的package包/类
@Override
public Observable<Void> merge(ChunkReadStream chunk, GeoJsonChunkMeta meta,
    WriteStream<Buffer> out) {
  mergeStarted = true;
  
  if (!headerWritten) {
    writeHeader(out);
    headerWritten = true;
  } else {
    if (mergedType == FEATURE_COLLECTION || mergedType == GEOMETRY_COLLECTION) {
      out.write(Buffer.buffer(","));
    } else {
      return Observable.error(new IllegalStateException(
        "Trying to merge two or more chunks but the merger has only been "
        + "initialized with one chunk."));
    }
  }
  
  // check if we have to wrap a geometry into a feature
  boolean wrap = mergedType == FEATURE_COLLECTION && !"Feature".equals(meta.getType());
  if (wrap) {
    out.write(Buffer.buffer("{\"type\":\"Feature\",\"geometry\":"));
  }
  
  return writeChunk(chunk, meta, out)
    .doOnNext(v -> {
      if (wrap) {
        out.write(Buffer.buffer("}"));
      }
    });
}
 
开发者ID:georocket,项目名称:georocket,代码行数:32,代码来源:GeoJsonMerger.java

示例4: sendResponse

import io.vertx.core.streams.WriteStream; //导入方法依赖的package包/类
private void sendResponse(Proto.Msg msg, WriteStream<Buffer> sock) {
    byte[] bytes = msg.toByteArray();
    Buffer response = Buffer.buffer();
    response.appendInt(bytes.length);
    response.appendBytes(bytes);
    sock.write(response);
}
 
开发者ID:blakepettersson,项目名称:reactmann,代码行数:8,代码来源:TcpMessageVerticle.java

示例5: sendMessageToClient

import io.vertx.core.streams.WriteStream; //导入方法依赖的package包/类
protected void sendMessageToClient(Buffer bytes, WriteStream<Buffer> writer, ReadStream<Buffer> reader) {
    try {
        writer.write(bytes);
        if (writer.writeQueueFull()) {
            reader.pause();
            writer.drainHandler( done -> reader.resume() );
        }
    } catch(Throwable e) {
        logger.error(e.getMessage());
    }
}
 
开发者ID:GruppoFilippetti,项目名称:vertx-mqtt-broker,代码行数:12,代码来源:MQTTSocket.java

示例6: writeFrame

import io.vertx.core.streams.WriteStream; //导入方法依赖的package包/类
public static void writeFrame(JsonObject payload, WriteStream<Buffer> handler) {
  // encode
  byte[] data = payload.encode().getBytes(UTF8);

  handler.write(Buffer.buffer().appendInt(data.length).appendBytes(data));
}
 
开发者ID:zzqfsy,项目名称:spring-vertx-tcp,代码行数:7,代码来源:FrameHelper.java

示例7: writeHeader

import io.vertx.core.streams.WriteStream; //导入方法依赖的package包/类
/**
 * Write the XML header and the parent elements
 * @param out the output stream to write to
 */
private void writeHeader(WriteStream<Buffer> out) {
  out.write(Buffer.buffer(XMLHEADER));
  parents.forEach(e -> out.write(Buffer.buffer(e.toString())));
}
 
开发者ID:georocket,项目名称:georocket,代码行数:9,代码来源:AbstractMergeStrategy.java

示例8: finish

import io.vertx.core.streams.WriteStream; //导入方法依赖的package包/类
@Override
public void finish(WriteStream<Buffer> out) {
  if (mergedType == FEATURE_COLLECTION || mergedType == GEOMETRY_COLLECTION) {
    out.write(Buffer.buffer("]}"));
  }
}
 
开发者ID:georocket,项目名称:georocket,代码行数:7,代码来源:GeoJsonMerger.java

示例9: writeTo

import io.vertx.core.streams.WriteStream; //导入方法依赖的package包/类
public void writeTo(WriteStream<Buffer> writeStream) {
  writeStream.write(buffer);
}
 
开发者ID:vert-x3,项目名称:vertx-redis-client,代码行数:4,代码来源:Command.java


注:本文中的io.vertx.core.streams.WriteStream.write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。