Java Long Number Align alignLength(int sectorSize, long remoteOffset, long len)

Here you can find the source of alignLength(int sectorSize, long remoteOffset, long len)

Description

align Length

License

Apache License

Declaration

public static long alignLength(int sectorSize, long remoteOffset,
            long len) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static long alignLength(int sectorSize, long remoteOffset,
            long len) {
        long alignedSize = len
                + namespaceSectorOffset(sectorSize, remoteOffset);
        if (namespaceSectorOffset(sectorSize, alignedSize) != 0) {
            alignedSize += (long) sectorSize
                    - namespaceSectorOffset(sectorSize, alignedSize);
        }/*from  w ww.j a va2s . c om*/
        return alignedSize;
    }

    public static long namespaceSectorOffset(int sectorSize, long fileOffset) {
        return fileOffset % (long) sectorSize;
    }
}

Related

  1. align(final long value, final long alignment)
  2. align(long size, long boundary)
  3. align(long value, int al)
  4. align(long value, long alignment)
  5. alignDown(long value, long granularity)
  6. alignOffset(int sectorSize, long fileOffset)
  7. alignQueryTimestampToBaseAggregationTime(long queryTimestamp)
  8. alignSize(long size)
  9. alignSize(long size, long alignment)