# Class: com.pnfsoftware.jeb.util.io.RotatingFileOutputStream

Output stream whose sinks are a series of files. When the output exceeds the maximum file count and maximum size per file, it gets rotated: older output gets deleted to make room for more recent output.

## Constructor: RotatingFileOutputStream
- parameter: `folder`, type: `java.io.File`
- parameter: `basename`, type: `java.lang.String`
- parameter: `rotFileCount`, type: `int`
- parameter: `rotFileSize`, type: `long`

Description: Create a rotating file\(s\) output stream. The stream is buffered, output is appended to existing files \(if any\).
parameter: folder: output folder; use null to denote the current working directory
parameter: basename: base file name
parameter: rotFileCount: number of rotated files to keep
parameter: rotFileSize: maximum size of the active output file
throws: if the initial output file cannot be opened

## Constructor: RotatingFileOutputStream
- parameter: `folder`, type: `java.io.File`
- parameter: `basename`, type: `java.lang.String`
- parameter: `rotFileCount`, type: `int`
- parameter: `rotFileSize`, type: `long`
- parameter: `buffered`, type: `boolean`
- parameter: `appendToExisting`, type: `boolean`

Description: Create a rotating file\(s\) output stream.
parameter: folder: output folder; use null to denote the current working directory
parameter: basename: base file name, must be non\-empty
parameter: rotFileCount: \>=0 \(can be 0 for no rotating output\); should be \>= 1
parameter: rotFileSize: \>0 \(cannot be negative or "infinite": a maximum file size must be            specified to prevent uncontrolled growth\)
parameter: buffered: enable or disable buffered\-writes \(recommended for high\-frequency writing\)
parameter: appendToExisting: append to a previously existing file, if any
throws: on IO error

## Method: close


## Method: flush


## Protected Method: generateFileSuffix
- parameter: `fileIndex`, type: `int`
- return type: `java.lang.String`

Description: The file suffix appended to the base filename for additional file. Note that the default implementation simply generates a ".N" suffix.
parameter: fileIndex: file index
return: generated file suffix

## Method: getAdditionalOutputFile
- parameter: `i`, type: `int`
- return type: `java.io.File`

Description: Retrieve an additional output file by index.
parameter: i: file index, must be in \[1, maximum\_filecount\]
return: rotated output file
throws: if the index is invalid

## Method: getOutputFile
- return type: `java.io.File`

Description: Retrieve the principal \(first\) output file.
return: active output file

## Method: getRotatingFileCount
- return type: `int`

Description: Get the configured number of rotated files to keep.
return: rotated file count

## Method: getRotatingFileSize
- return type: `long`

Description: Get the configured maximum size of the active output file.
return: maximum file size in bytes

## Method: getRotationCount
- return type: `long`

Description: Get the number of completed rotations.
return: rotation count

## Method: isBuffered
- return type: `boolean`

Description: Determine whether writes are buffered.
return: true if buffering is enabled

## Method: rotate

Description: Rotate output files immediately.
throws: if a file cannot be closed, renamed, created, or opened

## Method: write
- parameter: `b`, type: `int`


## Method: write
- parameter: `b`, type: `byte[]`
- parameter: `off`, type: `int`
- parameter: `len`, type: `int`


