congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
RotatingFileOutputStream
Code IndexAdd Tabnine to your IDE (free)

How to use
RotatingFileOutputStream
in
com.vlkan.rfos

Best Java code snippets using com.vlkan.rfos.RotatingFileOutputStream (Showing top 5 results out of 315)

origin: com.vlkan.hrrs/hrrs-serializer-base64

private static BufferedWriter createWriter(RotationConfig rotationConfig, Charset charset) {
  try {
    OutputStream outputStream = new RotatingFileOutputStream(rotationConfig);
    OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream, charset);
    return new BufferedWriter(outputStreamWriter);
  } catch (Exception error) {
    String message = String.format("failed opening file (file=%s, charset=%s)", rotationConfig.getFile(), charset);
    throw new RuntimeException(message, error);
  }
}
origin: com.vlkan.rfos/rotating-fos

private static void unsafeSyncCompress(File rotatedFile, File compressedFile) throws IOException {
  LOGGER.debug("compressing {rotatedFile={}, compressedFile={}}", rotatedFile, compressedFile);
  try (InputStream sourceStream = new FileInputStream(rotatedFile)) {
    try (OutputStream targetStream = new FileOutputStream(compressedFile)) {
      try (GZIPOutputStream gzipTargetStream = new GZIPOutputStream(targetStream)) {
        copy(sourceStream, gzipTargetStream);
        LOGGER.debug("deleting old file {rotatedFile={}}", rotatedFile);
        boolean deleted = rotatedFile.delete();
        if (!deleted) {
          String message = String.format("failed deleting old file {rotatedFile=%s}", rotatedFile);
          throw new IOException(message);
        }
      }
    }
  }
}
origin: com.vlkan.rfos/rotating-fos

public RotatingFileOutputStream(RotationConfig config) {
  this.config = config;
  this.runningThreads = Collections.synchronizedList(new LinkedList<Thread>());
  this.rotationLock = new ReentrantLock();
  this.stream = open();
  startPolicies();
}
origin: com.vlkan.rfos/rotating-fos

FileOutputStream newStream = open();
FileOutputStream oldStream;
Lock writeLock = config.getLock().writeLock();
  asyncCompress(policy, dateTime, rotatedFile, config.getCallback());
  return;
origin: com.vlkan.rfos/rotating-fos

@Override
public void rotate(RotationPolicy policy, LocalDateTime dateTime) {
  boolean acquired = rotationLock.tryLock();
  if (!acquired) {
    config.getCallback().onConflict(policy, dateTime);
  } else {
    try {
      unsafeRotate(policy, dateTime);
    } catch (Exception error) {
      String message = String.format("rotation failure {dateTime=%s}", dateTime);
      RuntimeException extendedError = new RuntimeException(message);
      config.getCallback().onFailure(policy, dateTime, null, extendedError);
    } finally {
      rotationLock.unlock();
    }
  }
}
com.vlkan.rfosRotatingFileOutputStream

Most used methods

  • <init>
  • asyncCompress
  • copy
  • open
  • startPolicies
  • unsafeRotate

Popular in Java

  • Running tasks concurrently on multiple threads
  • runOnUiThread (Activity)
  • findViewById (Activity)
  • compareTo (BigDecimal)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now