public class FileDelegate extends UnicastRemoteObject implements RemoteFile
DirectoryDelegate
,
Serialized Formref
Constructor and Description |
---|
FileDelegate(File file,
DirectoryDelegate parent) |
Modifier and Type | Method and Description |
---|---|
void |
appendContents(byte[] data)
Append the data to the file.
|
void |
copy(RemoteFile sourceFile)
Copy from another file to this one.
|
void |
destroy()
Destroy this directory entry, deleting the file or sub-directory.
|
RemoteDirectory |
getContainingDirectory()
Gets the directory containing this directory entry.
|
byte[] |
getContents(int offset,
int length)
Read from the file.
|
Date |
getModificationDate() |
String |
getName() |
String |
getNativeHost() |
String |
getNativeName() |
long |
getSize() |
void |
setContents(byte[] data)
Write the data to the file, totally replacing what was there before.
|
clone, exportObject, exportObject, exportObject, unexportObject
getClientHost, getLog, setLog
public FileDelegate(@Nonnull File file, @Nonnull DirectoryDelegate parent) throws RemoteException
file
- parent
- RemoteException
- If registration of the file fails.public byte[] getContents(int offset, int length) throws IOException
RemoteFile
getContents
in interface RemoteFile
offset
- Where in the file to read the bytes from.length
- How much of the file to read; -1 for "to the end".RemoteException
- If anything goes wrong with the communication.IOException
- If things go wrong reading the file.public long getSize()
getSize
in interface RemoteFile
public void setContents(byte[] data) throws IOException
RemoteFile
setContents
in interface RemoteFile
data
- The literal bytes that will form the new contents of the file.RemoteException
- If anything goes wrong with the communication.IOException
- If things go wrong writing the contents.public void appendContents(byte[] data) throws IOException
RemoteFile
appendContents
in interface RemoteFile
data
- The literal bytes that will be appended.RemoteException
- If anything goes wrong with the communication.IOException
- If things go wrong writing the contents.public void destroy() throws IOException
RemoteDirectoryEntry
destroy
in interface RemoteDirectoryEntry
RemoteException
- If anything goes wrong with the communication.IOException
- If things go wrong when deleting the directory entry.public RemoteDirectory getContainingDirectory()
RemoteDirectoryEntry
getContainingDirectory
in interface RemoteDirectoryEntry
public String getName()
getName
in interface RemoteDirectoryEntry
public void copy(RemoteFile sourceFile) throws RemoteException, IOException
RemoteFile
copy
in interface RemoteFile
sourceFile
- The other file to copy from.RemoteException
- If anything goes wrong with the communication.IOException
- If things go wrong during the copy.public String getNativeName()
getNativeName
in interface RemoteFile
public String getNativeHost()
getNativeHost
in interface RemoteFile
public Date getModificationDate() throws RemoteException
getModificationDate
in interface RemoteDirectoryEntry
RemoteException
- If anything goes wrong with the communication.Copyright © 2015–2018 The Apache Software Foundation. All rights reserved.