Package ome.api
Interface RawFileStore
-
- All Superinterfaces:
ServiceInterface,StatefulServiceInterface
public interface RawFileStore extends StatefulServiceInterface
Raw file gateway which provides access to the OMERO file repository.- Since:
- OMERO3.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanexists()Checks to see if a raw file exists with the file ID that the service was initialized with.java.lang.LonggetFileId()Returns the current file id or null if none has been set.byte[]read(long position, int length)Readslengthbytes of data at thepositionfrom the raw file into an array of bytesome.model.core.OriginalFilesave()Saves theOriginalFileassociated with the service if it has been modified.voidsetFileId(long fileId)This method manages the state of the service.longsize()Returns the size of the file on disk (not as stored in the database since that value will only be updated onsave().booleantruncate(long length)Limits the size of a file to the given length.voidwrite(byte[] buf, long position, int length)Writeslengthbytes of data from the specifiedbufbyte array starting at atpositionto the raw file-
Methods inherited from interface ome.api.StatefulServiceInterface
activate, close, getCurrentEventContext, passivate
-
-
-
-
Method Detail
-
getFileId
java.lang.Long getFileId()
Returns the current file id or null if none has been set.
-
setFileId
void setFileId(long fileId)
This method manages the state of the service. If the given file is not considered DOWNLOADABLE, this method will throw aSecurityViolation.- Parameters:
fileId- anOriginalFileid.
-
exists
boolean exists()
Checks to see if a raw file exists with the file ID that the service was initialized with.- Returns:
trueif there is an accessible file within the original file repository with the correct ID. Otherwisefalse.- Throws:
ome.conditions.ResourceError- if there is a problem accessing the file due to permissions errors within the repository or any other I/O error.
-
read
byte[] read(long position, int length)Readslengthbytes of data at thepositionfrom the raw file into an array of bytes
-
size
long size()
Returns the size of the file on disk (not as stored in the database since that value will only be updated onsave(). If the file has not yet been written to, and therefore does not exist, aResourceErrorwill be thrown.
-
truncate
boolean truncate(long length)
Limits the size of a file to the given length. If the file is already shorter than length, no action is taken in which case false is returned.
-
write
void write(byte[] buf, long position, int length)Writeslengthbytes of data from the specifiedbufbyte array starting at atpositionto the raw file
-
save
ome.model.core.OriginalFile save()
Saves theOriginalFileassociated with the service if it has been modified. The returned valued should replace all instances of theOriginalFilein the client. If save has not been called,RawFileStoreinstances will save theOriginalFileobject associated with it onStatefulServiceInterface.close().- See Also:
- 2161
-
-