Package org.eclipse.birt.core.archive
Class RAFileOutputStream
java.lang.Object
java.io.OutputStream
org.eclipse.birt.core.archive.RAOutputStream
org.eclipse.birt.core.archive.RAFileOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
This class is to be used by engine host (viewer), but not engine.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlonglonglonglength()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) voidwriteLong(long v) Methods inherited from class java.io.OutputStream
close, flush, nullOutputStream
-
Field Details
-
logger
the logger
-
-
Constructor Details
-
RAFileOutputStream
- Parameters:
parentFile- - underlying RandomAccess filestartPos- - the (global) position of the first character in parentFileendPos- - the (global) position of EOF mark (not a valid character in the file)
-
-
Method Details
-
write
The 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 classOutputStream- Parameters:
b- thebyte.- Throws:
IOException- if an I/O error occurs. In particular, anIOExceptionmay be thrown if the output stream has been closed.
-
write
Writesb.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 classOutputStream- Parameters:
b- the data.- Throws:
IOException- if an I/O error occurs.- See Also:
-
write
Writeslenbytes 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 classOutputStream- Parameters:
b- the data.off- the start offset in the data.len- the number of bytes to write.- Throws:
IOException- if an I/O error occurs.
-
writeInt
- Specified by:
writeIntin classRAOutputStream- Throws:
IOException
-
writeLong
- Specified by:
writeLongin classRAOutputStream- Throws:
IOException
-
seek
Same 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:
IOException
-
getOffset
- Specified by:
getOffsetin classRAOutputStream- Throws:
IOException
-
getStreamLength
public long getStreamLength()- Returns:
- the length of the stream
-
length
- Specified by:
lengthin classRAOutputStream- Throws:
IOException
-