com.jguild.jrpm.io.cpio
public final class CPIOOutputStream extends FilterOutputStream implements CPIOConstants
CPIOOutputStream cpioOut = new CPIOOutputStream(new BufferedOutputStream(
new FileOutputStream(new File("test.cpio"))));
CPIOEntry cpioEntry = new CPIOEntry();
cpioEntry.setName("testfile");
String testContents = "12345";
cpioEntry.setFileSize(testContents.length());
cpioOut.putNextEntry(cpioEntry);
cpioOut.write(testContents.getBytes());
cpioOut.finish();
cpioOut.close();
Note: This implementation should be compatible to cpio 2.5
| Constructor Summary | |
|---|---|
| CPIOOutputStream(OutputStream out, short format)
Construct the cpio output stream with a specified format
| |
| CPIOOutputStream(OutputStream out)
Construct the cpio output stream. | |
| Method Summary | |
|---|---|
| void | close()
Closes the CPIO output stream as well as the stream being filtered.
|
| void | closeEntry()
Closes the current CPIO entry and positions the stream for writing the
next entry.
|
| void | finish()
Finishes writing the contents of the CPIO output stream without closing
the underlying stream. |
| void | putNextEntry(CPIOEntry e)
Begins writing a new CPIO file entry and positions the stream to the
start of the entry data. |
| void | setFormat(short format)
Set a default header format. |
| void | write(byte[] b, int off, int len)
Writes an array of bytes to the current CPIO entry data. |
Parameters: out The cpio stream format The format of the stream
Parameters: out The cpio stream
Throws: IOException if an I/O error has occurred or if a CPIO file error has occurred
Throws: IOException if an I/O error has occurred or if a CPIO file error has occurred
Throws: IOException if an I/O exception has occurred or if a CPIO file error has occurred
Parameters: e the CPIO cpioEntry to be written
Throws: IOException if an I/O error has occurred or if a CPIO file error has occurred
Parameters: format A CPIO format
Parameters: b the data to be written off the start offset in the data len the number of bytes that are written
Throws: IOException if an I/O error has occurred or if a CPIO file error has occurred