Examples of writeTo()


Examples of org.apache.hadoop.io.simpleseekableformat.DataSegmentWriter.writeTo()

    // Write data to dataSegmentOutput
    ByteArrayOutputStream dataSegmentOutput = new ByteArrayOutputStream();
    for (int s = 0; s < segments; s++) {
      DataSegmentWriter writer = new DataSegmentWriter(data[s], codec, null);
      writer.writeTo(new DataOutputStream(dataSegmentOutput));
    }

    // Read dataSegments back to a Buffer
    byte[][] newData = new byte[segments][];
    ByteArrayInputStream dataSegmentInput =
View Full Code Here

Examples of org.apache.hadoop.yarn.proto.YarnServerCommonServiceProtos.RegisterNodeManagerResponseProto.writeTo()

  public static RegisterNodeManagerResponse serDe(RegisterNodeManagerResponse orig) throws Exception {
    RegisterNodeManagerResponsePBImpl asPB = (RegisterNodeManagerResponsePBImpl)orig;
    RegisterNodeManagerResponseProto proto = asPB.getProto();
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    proto.writeTo(out);
    ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
    RegisterNodeManagerResponseProto.Builder cp = RegisterNodeManagerResponseProto.newBuilder();
    cp.mergeFrom(in);
    return new RegisterNodeManagerResponsePBImpl(cp.build());
  }
View Full Code Here

Examples of org.apache.http.HttpEntity.writeTo()

     */
  public void writeTo(final OutputStream outputStream) throws IOException {
        if (this.httpResponse != null && this.currentRequest != null) {
            final HttpEntity httpEntity = this.httpResponse.getEntity();
            if (httpEntity != null) try {
                httpEntity.writeTo(outputStream);
                outputStream.flush();
                // Ensures that the entity content is fully consumed and the content stream, if exists, is closed.
                EntityUtils.consume(httpEntity);
                ConnectionInfo.removeConnection(this.currentRequest.hashCode());
                this.currentRequest = null;
View Full Code Here

Examples of org.apache.http.entity.FileEntity.writeTo()

        if (_dumpMessages) {
            _logger.info("Sending a POST request to [" + endpointURL + "]");
            ByteArrayOutputStream target = new ByteArrayOutputStream();
            try {
                requestEntity.writeTo(target);
                _logger.info("Request body:[" + target.toString() + "]");
            } catch (IOException e) {
                _logger.error("Unable to write FileEntity to stream", e);
            }
        }
View Full Code Here

Examples of org.apache.http.entity.StringEntity.writeTo()

        this.httpProcessor.process(response, context);

        // Commit the response
        conn.submitResponse(response);
        ContentOutputStream outstream = new ContentOutputStream(this.outbuffer);
        entity.writeTo(outstream);
        outstream.flush();

        // Test if the connection can be reused
        if (this.connStrategy.keepAlive(response, context)) {
            this.inbuffer.reset();
View Full Code Here

Examples of org.apache.http.entity.mime.HttpMultipart.writeTo()

        multipart.addBodyPart(p1);
        multipart.addBodyPart(p2);
        multipart.addBodyPart(p3);
       
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        multipart.writeTo(out);
        out.close();
       
        String expected =
            "--foo\r\n" +
            "Content-Type: text/plain\r\n" +
View Full Code Here

Examples of org.apache.http.entity.mime.MultipartEntity.writeTo()

            if (multiPart.isRepeatable()){
                ByteArrayOutputStream bos = new ByteArrayOutputStream();
                for(ViewableFileBody fileBody : fileBodies){
                    fileBody.hideFileData = true;
                }
                multiPart.writeTo(bos);
                for(ViewableFileBody fileBody : fileBodies){
                    fileBody.hideFileData = false;
                }
                bos.flush();
                // We get the posted bytes using the encoding used to create it
View Full Code Here

Examples of org.apache.http.entity.mime.content.ContentBody.writeTo()

            Map<String, String> resultMap = null;
            String key = "";
            final ContentBody keyBody = parts.get("key");
            if (keyBody != null) {
                final ByteArrayOutputStream baos = new ByteArrayOutputStream(20);
                keyBody.writeTo(baos);
                key = baos.toString();
            }
            parts.put("myseed", UTF8.StringBody((mySeed == null) ? "" : mySeed.genSeedStr(key)));
            parts.put("count", UTF8.StringBody(Integer.toString(Math.max(10, count))));
            parts.put("time", UTF8.StringBody(Long.toString(Math.max(3000, time))));
View Full Code Here

Examples of org.apache.http.impl.client.cache.DefaultHttpCacheEntrySerializer.writeTo()

         * least we encapsulate it off here in its own method so
         * the test that uses it remains clear.
         */
        DefaultHttpCacheEntrySerializer ser = new DefaultHttpCacheEntrySerializer();
        ByteArrayOutputStream bos1 = new ByteArrayOutputStream();
        ser.writeTo(entry, bos1);
        byte[] bytes1 = bos1.toByteArray();
        ByteArrayOutputStream bos2 = new ByteArrayOutputStream();
        ser.writeTo(resultEntry, bos2);
        byte[] bytes2 = bos2.toByteArray();
        assertEquals(bytes1.length, bytes2.length);
View Full Code Here

Examples of org.apache.jackrabbit.oak.plugins.segment.Segment.writeTo()

            response.sendError(HttpServletResponse.SC_NOT_FOUND);
            return;
        }

        response.setContentType("application/octet-stream");
        segment.writeTo(response.getOutputStream());
    }

    private void doPutSegment(
            String info,
            HttpServletRequest request, HttpServletResponse response)
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.