palmed.buffer
Class Buffer

java.lang.Object
  extended by palmed.buffer.Buffer
All Implemented Interfaces:
IBuffer, ISerializable

public final class Buffer
extends java.lang.Object
implements IBuffer

This class implements an association between a text box content and a file.

Version:
$Revision: 409 $ $Date: 2006-01-02 17:50:37 +0900 (lun., 02 janv. 2006) $
Author:
Mathieu Champlon

Constructor Summary
Buffer(ITextBox textBox)
          Create an empty 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.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Buffer

public Buffer(ITextBox textBox)
Create an empty buffer.

Parameters:
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

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

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

delete

public void delete()
Delete the buffer.

Specified by:
delete in interface IBuffer


Copyright © 2004-2006 PalmEd. All Rights Reserved.