Package org.eclipse.birt.core.archive
Class RAFolderOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.eclipse.birt.core.archive.RAOutputStream
-
- org.eclipse.birt.core.archive.RAFolderOutputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
public class RAFolderOutputStream extends RAOutputStream
RAOutputStream implementation for folder based report archive
-
-
Constructor Summary
Constructors Constructor Description RAFolderOutputStream(java.util.Collection<RAFolderOutputStream> manager, java.io.File file)RAFolderOutputStream(java.util.Collection<RAFolderOutputStream> manager, java.io.File file, boolean append)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the stream.voidflush()Flush the stream.java.lang.StringgetName()longgetOffset()longlength()voidseek(long localPos)Same behavior as the seek in RandomAccessFile.voidwrite(byte[] b)Writesb.lengthbytes from the specified byte array to this output stream.voidwrite(byte[] b, int off, int len)Writeslenbytes from the specified byte array starting at offsetoffto this output stream.voidwrite(int b)The same behavior as OutputStream.write().voidwriteInt(int v)Same behavior as DataOutputStream.writeInt();voidwriteLong(long v)Same behavior as DataOutputStream.writeLong();
-
-
-
Constructor Detail
-
RAFolderOutputStream
public RAFolderOutputStream(java.util.Collection<RAFolderOutputStream> manager, java.io.File file) throws java.io.FileNotFoundException, java.io.IOException
- Throws:
java.io.FileNotFoundExceptionjava.io.IOException
-
RAFolderOutputStream
public RAFolderOutputStream(java.util.Collection<RAFolderOutputStream> manager, java.io.File file, boolean append) throws java.io.FileNotFoundException, java.io.IOException
- Throws:
java.io.FileNotFoundExceptionjava.io.IOException
-
-
Method Detail
-
getName
public java.lang.String getName()
-
write
public void write(int b) throws java.io.IOExceptionThe same behavior as OutputStream.write().
Writes the specified byte to this output stream. The general contract forwriteis that one byte is written to the output stream. The byte to be written is the eight low-order bits of the argumentb. The 24 high-order bits ofbare ignored.Subclasses of
OutputStreammust provide an implementation for this method.- Specified by:
writein classjava.io.OutputStream- Parameters:
b- thebyte.- Throws:
java.io.IOException- if an I/O error occurs. In particular, anIOExceptionmay be thrown if the output stream has been closed.
-
write
public void write(byte[] b) throws java.io.IOExceptionWritesb.lengthbytes from the specified byte array to this output stream. The general contract forwrite(b)is that it should have exactly the same effect as the callwrite(b, 0, b.length).- Overrides:
writein classjava.io.OutputStream- Parameters:
b- the data.- Throws:
java.io.IOException- if an I/O error occurs.- See Also:
OutputStream.write(byte[], int, int)
-
write
public void write(byte[] b, int off, int len) throws java.io.IOExceptionWriteslenbytes from the specified byte array starting at offsetoffto this output stream. The general contract forwrite(b, off, len)is that some of the bytes in the arraybare written to the output stream in order; elementb[off]is the first byte written andb[off+len-1]is the last byte written by this operation.- Overrides:
writein classjava.io.OutputStream- Parameters:
b- the data.off- the start offset in the data.len- the number of bytes to write.- Throws:
java.io.IOException- if an I/O error occurs.
-
writeInt
public void writeInt(int v) throws java.io.IOExceptionSame behavior as DataOutputStream.writeInt();- Specified by:
writeIntin classRAOutputStream- Throws:
java.io.IOException
-
writeLong
public void writeLong(long v) throws java.io.IOExceptionSame behavior as DataOutputStream.writeLong();- Specified by:
writeLongin classRAOutputStream- Throws:
java.io.IOException
-
getOffset
public long getOffset() throws java.io.IOException- Specified by:
getOffsetin classRAOutputStream- Throws:
java.io.IOException
-
seek
public void seek(long localPos) throws java.io.IOExceptionSame behavior as the seek in RandomAccessFile.
Sets the file-pointer offset, measured from the beginning of this file, at which the next read or write occurs. The offset may be set beyond the end of the file. Setting the offset beyond the end of the file does not change the file length. The file length will change only by writing after the offset has been set beyond the end of the file.- Specified by:
seekin classRAOutputStream- Parameters:
localPos- - the new local postion in the stream, measured in bytes from the beginning of the stream- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOExceptionFlush the stream.- Specified by:
flushin interfacejava.io.Flushable- Overrides:
flushin classjava.io.OutputStream- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOExceptionClose the stream. If the stream is the only one in the underlying file, the file will be close too.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.OutputStream- Throws:
java.io.IOException
-
length
public long length() throws java.io.IOException- Specified by:
lengthin classRAOutputStream- Throws:
java.io.IOException
-
-