Codota Logo
Range.fromOffsetLength
Code IndexAdd Codota to your IDE (free)

How to use
fromOffsetLength
method
in
com.emc.object.Range

Best Java code snippets using com.emc.object.Range.fromOffsetLength (Showing top 6 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
LocalDateTime l =
  • Codota Iconnew LocalDateTime()
  • Codota IconLocalDateTime.now()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseLocalDateTime(text)
  • Smart code suggestions by Codota
}
origin: com.emc.ecs/object-client

while (offset < objectSize) {
  if (offset + length > objectSize) length = objectSize - offset;
  futures.add(executorService.submit(new DownloadPartTask(Range.fromOffsetLength(offset, length), channel)));
  offset += length;
origin: com.emc.ecs/object-client

  @Override
  public String call() throws Exception {
    Range range = Range.fromOffsetLength(offset, length);
    InputStream is = file != null ? new FileInputStream(file) : stream;
    is = new ProgressInputStream(is, LargeFileUploader.this);
    SizedInputStream segmentStream = file != null
        ? new InputStreamSegment(is, offset, length)
        : new SizedInputStream(is, length);
    PutObjectRequest request = new PutObjectRequest(bucket, key, segmentStream).withRange(range);
    return s3Client.putObject(request).getETag();
  }
}
origin: pravega/pravega

private int doRead(SegmentHandle handle, long offset, byte[] buffer, int bufferOffset, int length) throws Exception {
  long traceId = LoggerHelpers.traceEnter(log, "read", handle.getSegmentName(), offset, bufferOffset, length);
  if (offset < 0 || bufferOffset < 0 || length < 0) {
    throw new ArrayIndexOutOfBoundsException();
  }
  try (InputStream reader = client.readObjectStream(config.getBucket(),
      config.getRoot() + handle.getSegmentName(), Range.fromOffsetLength(offset, length))) {
    /*
     * TODO: This implementation assumes that if S3Client.readObjectStream returns null, then
     * the object does not exist and we throw StreamNotExistsException. The javadoc, however,
     * says that this call returns null in case of 304 and 412 responses. We need to
     * investigate what these responses mean precisely and react accordingly.
     *
     * See https://github.com/pravega/pravega/issues/1549
     */
    if (reader == null) {
      throw new StreamSegmentNotExistsException(handle.getSegmentName());
    }
    int bytesRead = StreamHelpers.readAll(reader, buffer, bufferOffset, length);
    LoggerHelpers.traceLeave(log, "read", traceId, bytesRead);
    return bytesRead;
  }
}
origin: pravega/pravega

private Void doWrite(SegmentHandle handle, long offset, InputStream data, int length) throws StreamSegmentException {
  Preconditions.checkArgument(!handle.isReadOnly(), "handle must not be read-only.");
  long traceId = LoggerHelpers.traceEnter(log, "write", handle.getSegmentName(), offset, length);
  SegmentProperties si = doGetStreamSegmentInfo(handle.getSegmentName());
  if (si.isSealed()) {
    throw new StreamSegmentSealedException(handle.getSegmentName());
  }
  if (si.getLength() != offset) {
    throw new BadOffsetException(handle.getSegmentName(), si.getLength(), offset);
  }
  client.putObject(this.config.getBucket(), this.config.getRoot() + handle.getSegmentName(),
      Range.fromOffsetLength(offset, length), data);
  LoggerHelpers.traceLeave(log, "write", traceId);
  return null;
}
origin: pravega/pravega

  @Override
  public CopyPartResult copyPart(CopyPartRequest request) {
    Range range = request.getSourceRange();
    if (range.getLast() == -1) {
      range = Range.fromOffsetLength(0, aclMap.get(request.getSourceKey()).getSize());
      request.withSourceRange(range);
    }
    CopyObjectResult result = executeRequest(client, request, CopyObjectResult.class);
    CopyPartResult retVal = new CopyPartResult();
    retVal.setPartNumber(request.getPartNumber());
    retVal.setETag(result.getETag());
    return retVal;
  }
}
origin: pravega/pravega

    targetPath,
    uploadId,
    1).withSourceRange(Range.fromOffsetLength(0, offset));
CopyPartResult copyResult = client.copyPart(copyRequest);
    targetPath,
    uploadId,
    2).withSourceRange(Range.fromOffsetLength(0, objectSize));
com.emc.objectRangefromOffsetLength

Popular methods of Range

  • getFirst
  • <init>
  • fromOffset
  • getLast
  • toString

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setRequestProperty (URLConnection)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • Kernel (java.awt.image)
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • JComboBox (javax.swing)
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now