de.matthias_burbach.mosaique4eclipse.util
Class FileStorage

java.lang.Object
  extended byorg.eclipse.core.runtime.PlatformObject
      extended byde.matthias_burbach.mosaique4eclipse.util.FileStorage
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, org.eclipse.core.resources.IStorage

public class FileStorage
extends org.eclipse.core.runtime.PlatformObject
implements org.eclipse.core.resources.IStorage

Wraps a file as an IStorage.


Constructor Summary
FileStorage(org.eclipse.core.runtime.IPath path)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
           Two FileStorages are equal if their IPaths are equal.
 java.io.InputStream getContents()
          
 org.eclipse.core.runtime.IPath getFullPath()
          
 java.lang.String getName()
          
 int hashCode()
          
 boolean isReadOnly()
          
 void setContents(java.io.InputStream stream, boolean overwrite, org.eclipse.core.runtime.IProgressMonitor monitor)
          Writes the contents of the given input stream to the encapsulated file.
 void setReadOnly()
          Some document providers (notably CompilationUnitDocumentProvider) can't handle read/write storage.
 java.lang.String toString()
           The OS specific representation of the file's path.
 
Methods inherited from class org.eclipse.core.runtime.PlatformObject
getAdapter
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Constructor Detail

FileStorage

public FileStorage(org.eclipse.core.runtime.IPath path)
Parameters:
path - The path of the file to encapsulate. Must not be null.
Method Detail

getContents

public java.io.InputStream getContents()
                                throws org.eclipse.core.runtime.CoreException

Specified by:
getContents in interface org.eclipse.core.resources.IStorage
Throws:
org.eclipse.core.runtime.CoreException

getFullPath

public org.eclipse.core.runtime.IPath getFullPath()

Specified by:
getFullPath in interface org.eclipse.core.resources.IStorage

getName

public java.lang.String getName()

Specified by:
getName in interface org.eclipse.core.resources.IStorage

isReadOnly

public boolean isReadOnly()

Specified by:
isReadOnly in interface org.eclipse.core.resources.IStorage

setContents

public void setContents(java.io.InputStream stream,
                        boolean overwrite,
                        org.eclipse.core.runtime.IProgressMonitor monitor)
                 throws org.eclipse.core.runtime.CoreException
Writes the contents of the given input stream to the encapsulated file.

Parameters:
stream - The input stream to write to the file.
overwrite - Whether to overwrite the existing file or not. Is ignored.
monitor - The progress monitor to feed with progress on writing the input stream to the file. Is ignored.
Throws:
org.eclipse.core.runtime.CoreException - if anything goes wrong

setReadOnly

public void setReadOnly()
Some document providers (notably CompilationUnitDocumentProvider) can't handle read/write storage.


equals

public boolean equals(java.lang.Object obj)
Two FileStorages are equal if their IPaths are equal.


hashCode

public int hashCode()


toString

public java.lang.String toString()
The OS specific representation of the file's path.



Copyright © 2005-2006 . All Rights Reserved.