Examples of BufferFileInputStream


Examples of backtype.storm.utils.BufferFileInputStream

  }

  @Override
  public String beginFileDownload(String file) throws TException {
    BufferFileInputStream is = null;
    String id = null;
    try {
      int bufferSize = JStormUtils
          .parseInt(conf.get(Config.NIMBUS_THRIFT_MAX_BUFFER_SIZE),
              1024 * 1024) / 2;

      is = new BufferFileInputStream(file, bufferSize);
      id = UUID.randomUUID().toString();
      data.getDownloaders().put(id, is);
    } catch (FileNotFoundException e) {
      LOG.error(e + "file:" + file + " not found");
      throw new TException(e);
View Full Code Here

Examples of backtype.storm.utils.BufferFileInputStream

    }

    try {
      if (obj instanceof BufferFileInputStream) {

        BufferFileInputStream is = (BufferFileInputStream) obj;
        byte[] ret = is.read();
        if (ret != null) {
          downloaders.put(id, (BufferFileInputStream) is);
          return ByteBuffer.wrap(ret);
        }
      } else {
View Full Code Here

Examples of co.cask.cdap.internal.app.BufferFileInputStream

    request.setHeader(Constants.Gateway.API_KEY, "api-key-example");
    request.setHeader("X-Archive-Name", applicationId + ".jar");
    MockResponder mockResponder = new MockResponder();
    BodyConsumer bodyConsumer = httpHandler.deploy(request, mockResponder);

    BufferFileInputStream is = new BufferFileInputStream(deployedJar.getInputStream(), 100 * 1024);
    try {
      byte[] chunk = is.read();
      while (chunk.length > 0) {
        mockResponder = new MockResponder();
        bodyConsumer.chunk(ChannelBuffers.wrappedBuffer(chunk), mockResponder);
        Preconditions.checkState(mockResponder.getStatus() == null, "failed to deploy app");
        chunk = is.read();
      }
      mockResponder = new MockResponder();
      bodyConsumer.finished(mockResponder);
      Preconditions.checkState(mockResponder.getStatus().getCode() == 200, "failed to deploy app");
    } catch (Exception e) {
      throw Throwables.propagate(e);
    } finally {
      is.close();
    }
    return deployedJar;
  }
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.