palmed.buffer
Class RecordBuffer

java.lang.Object
  extended by palmed.buffer.RecordBuffer
All Implemented Interfaces:
IBuffer, IRecordBuffer, IRecord, ISerializable

public final class RecordBuffer
extends java.lang.Object
implements IRecordBuffer

This class provides an adapter between records and buffers.

Version:
$Revision: 377 $ $Date: 2005-12-29 14:25:52 +0900 (jeu., 29 déc. 2005) $
Author:
Mathieu Champlon

Constructor Summary
RecordBuffer(IRecordFactory factory, ITextBox textBox)
          Create a record buffer.
 
Method Summary
 void delete()
          Delete the buffer.
 boolean hasBeenModified()
          Test if the buffer has been modified.
 boolean hasFile(IFile file)
          Test if the given file is handled by the buffer.
 void marshall(java.io.OutputStream stream)
          Write to an output stream.
 void open(IFile file)
          Open the given file.
 void persist()
          Save the record.
 void readReference(java.io.InputStream stream)
          Read from an input stream.
 void restore()
          Load the record.
 boolean save()
          Save the file.
 void save(IFile file)
          Save into the given file.
 void unmarshall(java.io.InputStream stream)
          Read from an input stream.
 void writeReference(java.io.OutputStream stream)
          Write to an output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RecordBuffer

public RecordBuffer(IRecordFactory factory,
                    ITextBox textBox)
Create a record buffer.

Parameters:
factory - the record factory
textBox - the text box
Method Detail

open

public void open(IFile file)
Open the given file.

Specified by:
open in interface IBuffer
Parameters:
file - the file to read from

save

public boolean save()
Save the file.

This operation must fail if no file is associated to the buffer.

Specified by:
save in interface IBuffer
Returns:
whether the file could be saved or not

save

public void save(IFile file)
Save into the given file.

Specified by:
save in interface IBuffer
Parameters:
file - the file to write into

hasBeenModified

public boolean hasBeenModified()
Test if the buffer has been modified.

Specified by:
hasBeenModified in interface IBuffer
Returns:
whether the buffer has been modified or not

hasFile

public boolean hasFile(IFile file)
Test if the given file is handled by the buffer.

Specified by:
hasFile in interface IBuffer
Parameters:
file - the file
Returns:
whether the buffer handles the file or not

unmarshall

public void unmarshall(java.io.InputStream stream)
                throws java.io.IOException
Read from an input stream.

Specified by:
unmarshall in interface ISerializable
Parameters:
stream - the stream to read from
Throws:
java.io.IOException - an io exception occurs

marshall

public void marshall(java.io.OutputStream stream)
              throws java.io.IOException
Write to an output stream.

Specified by:
marshall in interface ISerializable
Parameters:
stream - the stream to write to
Throws:
java.io.IOException - an io exception occurs

persist

public void persist()
Save the record.

Specified by:
persist in interface IRecord

restore

public void restore()
Load the record.

Specified by:
restore in interface IRecord

delete

public void delete()
Delete the buffer.

Specified by:
delete in interface IBuffer
Specified by:
delete in interface IRecord

readReference

public void readReference(java.io.InputStream stream)
                   throws java.io.IOException
Read from an input stream.

Specified by:
readReference in interface IRecordBuffer
Parameters:
stream - the stream to read from
Throws:
java.io.IOException - an io exception occurs

writeReference

public void writeReference(java.io.OutputStream stream)
                    throws java.io.IOException
Write to an output stream.

Specified by:
writeReference in interface IRecordBuffer
Parameters:
stream - the stream to write to
Throws:
java.io.IOException - an io exception occurs


Copyright © 2004-2006 PalmEd. All Rights Reserved.