Class FilePadding
- java.lang.Object
- 
- org.apache.zookeeper.server.persistence.FilePadding
 
- 
 public class FilePadding extends Object 
- 
- 
Constructor SummaryConstructors Constructor Description FilePadding()
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static longcalculateFileSizeWithPadding(long position, long fileSize, long preAllocSize)Calculates a new file size with padding.static longgetPreAllocSize()Getter of preAllocSize has been added for testingvoidsetCurrentSize(long currentSize)static voidsetPreallocSize(long size)method to allow setting preallocate size of log file to pad the file.
 
- 
- 
- 
Method Detail- 
getPreAllocSizepublic static long getPreAllocSize() Getter of preAllocSize has been added for testing
 - 
setPreallocSizepublic static void setPreallocSize(long size) method to allow setting preallocate size of log file to pad the file.- Parameters:
- size- the size to set to in bytes
 
 - 
setCurrentSizepublic void setCurrentSize(long currentSize) 
 - 
calculateFileSizeWithPaddingpublic static long calculateFileSizeWithPadding(long position, long fileSize, long preAllocSize)Calculates a new file size with padding. We only return a new size if the current file position is sufficiently close (less than 4K) to end of file and preAllocSize is > 0.- Parameters:
- position- the point in the file we have written to
- fileSize- application keeps track of the current file size
- preAllocSize- how many bytes to pad
- Returns:
- the new file size. It can be the same as fileSize if no padding was done.
 
 
- 
 
-