1 8 package org.jivesoftware.util.log.output.io.rotate; 9 10 import java.io.File ; 11 12 17 public class RotateStrategyBySize 18 implements RotateStrategy { 19 private long m_maxSize; 20 private long m_currentSize; 21 22 26 public RotateStrategyBySize() { 27 this(1024 * 1024); 28 } 29 30 35 public RotateStrategyBySize(final long maxSize) { 36 m_currentSize = 0; 37 m_maxSize = maxSize; 38 } 39 40 43 public void reset() { 44 m_currentSize = 0; 45 } 46 47 53 public boolean isRotationNeeded(final String data, final File file) { 54 m_currentSize += data.length(); 55 if (m_currentSize >= m_maxSize) { 56 m_currentSize = 0; 57 return true; 58 } 59 else { 60 return false; 61 } 62 } 63 } 64 65 | Popular Tags |