throws IOException {
FileSystem fs = tablePath.getFileSystem(conf);
long defaultBlockSize = size;
List<FileFragment> listTablets = new ArrayList<FileFragment>();
FileFragment tablet;
FileStatus[] fileLists = fs.listStatus(tablePath);
for (FileStatus file : fileLists) {
long remainFileSize = file.getLen();
long start = 0;
if (remainFileSize > defaultBlockSize) {
while (remainFileSize > defaultBlockSize) {
tablet = new FileFragment(tableName, file.getPath(), start, defaultBlockSize);
listTablets.add(tablet);
start += defaultBlockSize;
remainFileSize -= defaultBlockSize;
}
listTablets.add(new FileFragment(tableName, file.getPath(), start, remainFileSize));
} else {
listTablets.add(new FileFragment(tableName, file.getPath(), 0, remainFileSize));
}
}
FileFragment[] tablets = new FileFragment[listTablets.size()];
listTablets.toArray(tablets);