org.eclipse.mofscript.runtime
Class BlockOutputStream
java.lang.Object
java.io.OutputStream
org.eclipse.mofscript.runtime.BlockOutputStream
- All Implemented Interfaces:
- java.io.Closeable, java.io.Flushable
public class BlockOutputStream
- extends java.io.OutputStream
Class to handle files and containing blocks
- Author:
- jol, gko
Methods inherited from class java.io.OutputStream |
close, flush, write, write |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_fileBlock
BlockOutputStream.FileBlock _fileBlock
_existingFile
BlockOutputStream.FileBlock _existingFile
_fileUri
java.lang.String _fileUri
_unprotectedIdCounter
int _unprotectedIdCounter
_startLine
int _startLine
_endLine
int _endLine
appendMode
boolean appendMode
BlockOutputStream
public BlockOutputStream(java.lang.String fileUri)
- Parameters:
fileUri
-
BlockOutputStream
public BlockOutputStream(java.lang.String fileUri,
boolean append)
getIdBlockCounter
public int getIdBlockCounter(java.lang.String objectId)
- Parameters:
objectId
-
- Returns:
increaseIdCounter
public void increaseIdCounter(java.lang.String objectId)
getBlockWithId
public BlockOutputStream.FileBlock getBlockWithId(java.lang.String id)
- Parameters:
id
-
- Returns:
write
public void write(int b)
throws java.io.IOException
- Specified by:
write
in class java.io.OutputStream
- Throws:
java.io.IOException
newBlock
public void newBlock(boolean isProtected,
java.lang.String id)
- Parameters:
isProtected
- id
-
getLineDifference
public int getLineDifference(java.lang.String blockId)
- Gets the difference in lines between a new block an an existing (pre-read) block
writeToFile
public void writeToFile()
merge
protected void merge()
append
protected void append()
- Appends _fileBlock to the end of _existingFile
Then sets the _fileBlock to reference the beginning
of _existingFile
position
public int position()
preReadFile
protected void preReadFile()
get_fileUri
public java.lang.String get_fileUri()
- Returns:
get_fileBlock
public BlockOutputStream.FileBlock get_fileBlock()
- Returns: