Java Array Reverse getReverseOffsets(long fileLength, long position, byte[] buffer, int size)

Here you can find the source of getReverseOffsets(long fileLength, long position, byte[] buffer, int size)

Description

get Reverse Offsets

License

Apache License

Declaration

public static List<Long> getReverseOffsets(long fileLength, long position, byte[] buffer, int size) 

Method Source Code

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

import java.util.ArrayList;
import java.util.List;

public class Main {
    public static List<Long> getReverseOffsets(long fileLength, long position, byte[] buffer, int size) {
        List<Long> offsets = new ArrayList<Long>();

        if (size > 0) {
            for (int ii = size - 1; ii >= 0; ii--) {
                if ('\n' == buffer[ii] && (fileLength != position + ii + 1)) {
                    offsets.add(position + ii + 1);
                }//from ww  w  .  j ava2 s  .co  m
            }
        }

        return offsets;
    }
}

Related

  1. arrayReverse(byte[] array, int begin, int length)
  2. arrayReverse(Object[] array)
  3. arrayReverse(Object[] array)
  4. arrayReverse(T[] array)
  5. ArraysReverse(byte[] array)
  6. reverse(T[] array)
  7. reverse(T[] array)
  8. reverse(T[] array)
  9. reverse(T[] array)