Examples of writeTo()


Examples of com.google.api.client.http.HttpContent.writeTo()

        if (length != -1) {
          writeHeader(writer, "Content-Length", length);
        }
        writer.write(CR_LF);
        writer.flush();
        data.writeTo(out);
      }
      writer.write(CR_LF);
    }

    // Write the end of the batch separator.
View Full Code Here

Examples of com.google.api.client.http.UrlEncodedContent.writeTo()

    Arrays.fill(arr2, 'x');
    arr2[0] = 'a';
    arr2[1] = '=';
    UrlEncodedContent content = (UrlEncodedContent) request.getContent();
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    content.writeTo(out);
    assertEquals(new String(arr2), out.toString());
  }
}
View Full Code Here

Examples of com.google.api.client.http.json.JsonHttpContent.writeTo()

  }

  public static <T> String parseDoubanObjToJSONStr(T obj) throws IOException {
    JsonHttpContent content = new JsonHttpContent(new JacksonFactory(), obj);
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    content.writeTo(os);
    String result = new String(os.toByteArray());
    return result;
  }
 
  public static <T> String parseDoubanObjToXMLStr(T obj) throws IOException {
View Full Code Here

Examples of com.google.api.client.http.xml.XmlHttpContent.writeTo()

  }
 
  public static <T> String parseDoubanObjToXMLStr(T obj) throws IOException {
    XmlHttpContent content = new XmlHttpContent(DefaultConfigs.DOUBAN_XML_NAMESPACE, "entry", obj);
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    content.writeTo(os);
    String result = new String(os.toByteArray());
    return result;
  }

  public static void main(String[] args) {
View Full Code Here

Examples of com.google.k2crypto.KeyProto.KeyData.writeTo()

  private static byte[] serializeKey(Key key) throws StoreIOException {
    try {
      KeyData data = key.buildData().build();
      byte[] bytes = new byte[data.getSerializedSize()];
      CodedOutputStream cos = CodedOutputStream.newInstance(bytes);
      data.writeTo(cos);
      cos.checkNoSpaceLeft();
      return bytes;
    } catch (Exception ex) {
      throw new StoreIOException(
          StoreIOException.Reason.SERIALIZATION_ERROR, ex);
View Full Code Here

Examples of com.google.protobuf.ByteString.Output.writeTo()

 
  public void testNewOutput_Mutating() throws IOException {
    Output os = ByteString.newOutput(5);
    os.write(new byte[] {1, 2, 3, 4, 5});
    EvilOutputStream eos = new EvilOutputStream();
    os.writeTo(eos);
    byte[] capturedArray = eos.capturedArray;
    ByteString byteString = os.toByteString();
    byte[] oldValue = byteString.toByteArray();
    Arrays.fill(capturedArray, (byte) 0);
    byte[] newValue = byteString.toByteArray();
View Full Code Here

Examples of com.google.protobuf.DynamicMessage.writeTo()

        int pos = value.getEncodedSize();
        Util.putInt(value.getEncodedBytes(), pos, converter.getTableId());
        pos += 4;
        CodedOutputStream cstr = CodedOutputStream.newInstance(value.getEncodedBytes(), pos, size);
        try {
            msg.writeTo(cstr);
        }
        catch (IOException ex) {
            throw new ConversionException(ex);
        }
        pos += size;
View Full Code Here

Examples of com.google.protobuf.Message.writeTo()

      benchmark("Serialize to byte array", inputData.length, new Action() {
        public void execute() { sampleMessage.toByteArray(); }
      });
      benchmark("Serialize to memory stream", inputData.length, new Action() {
        public void execute() throws IOException {
          sampleMessage.writeTo(new ByteArrayOutputStream());
        }
      });
      if (devNull != null) {
        benchmark("Serialize to /dev/null with FileOutputStream", inputData.length, new Action() {
          public void execute() throws IOException {
View Full Code Here

Examples of com.google.transit.realtime.GtfsRealtime.FeedMessage.writeTo()

  }

  @RequestMapping(value = "/gtfs-realtime/trip-updates.action")
  public void tripUpdates(OutputStream out) throws IOException {
    FeedMessage tripUpdates = _gtfsRealtimeService.getTripUpdates();
    tripUpdates.writeTo(out);
  }

  @RequestMapping(value = "/gtfs-realtime/vehicle-positions.action")
  public void vehiclePositions(OutputStream out) throws IOException {
    FeedMessage vehiclePositions = _gtfsRealtimeService.getVehiclePositions();
View Full Code Here

Examples of com.hazelcast.com.eclipsesource.json.JsonObject.writeTo()

                try {
                    JsonObject root = new JsonObject();
                    root.add("identifier", identifier.toJson());
                    TimedMemberState timedMemberState = timedMemberStateFactory.createTimedMemberState();
                    root.add("timedMemberState", timedMemberState.toJson());
                    root.writeTo(writer);
                    writer.flush();
                    outputStream.flush();
                    post(connection);
                } finally {
                    closeResource(writer);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.