
com.antiaction.common.cli.RandomAccessFileOutputStream Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of common-cli Show documentation
Show all versions of common-cli Show documentation
Multipurpose library for handling commnad line interface arguments.
The newest version!
package com.antiaction.common.cli;
import java.io.IOException;
import java.io.OutputStream;
import java.io.RandomAccessFile;
/**
* This class wraps a RandomAccessFile
into a usable
* OutputStream
which supports random re-position.
* Re-positioning is done by using seek() on the RandomAccessFile
* object. (@see RandomAccessFile#seek())
*
* @author nicl
*/
public class RandomAccessFileOutputStream extends OutputStream {
/** Encapsulated RandomAccessFile
used for stream data. */
protected RandomAccessFile raf;
/**
* Create a new random access OutputStream
with repositioning
* capabilities.
* @param raf RandomAccessFile
used for stream data
*/
public RandomAccessFileOutputStream(RandomAccessFile raf) {
this.raf = raf;
}
/**
* Closing this stream has no effect.
* @throws IOException if an i/o error occurs while closing stream
*/
@Override
public void close() throws IOException {
raf = null;
}
/**
* Flushing this stream has no effect.
* @throws IOException if an i/o error occurs while flushing stream
*/
@Override
public void flush() throws IOException {
}
@Override
public void write(int b) throws IOException {
raf.write(b);
}
@Override
public void write(byte[] b) throws IOException {
raf.write(b);
}
@Override
public void write(byte[] b, int off, int len) throws IOException {
raf.write(b, off, len);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy