Class File
java.lang.Object
com.hierynomus.smbj.share.Open<DiskShare>
com.hierynomus.smbj.share.DiskEntry
com.hierynomus.smbj.share.File
- All Implemented Interfaces:
Closeable, AutoCloseable
-
Nested Class Summary
Nested classes/interfaces inherited from class Open
Open.LockBuilder -
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetInputStream(ProgressListener listener) getOutputStream(boolean append) getOutputStream(ProgressListener listener) getOutputStream(ProgressListener listener, boolean append) intread(byte[] buffer, long fileOffset) Read data from this file starting at position fileOffset into the given buffer.intread(byte[] buffer, long fileOffset, int offset, int length) Read data from this file starting at position fileOffset into the given buffer.voidread(OutputStream destStream) voidread(OutputStream destStream, ProgressListener progressListener) longread(ByteBuffer buffer, long fileOffset) Read data from this file starting at position fileOffset into the givenByteBuffer.voidremoteCopyTo(long offset, File destination, long destinationOffset, long length) Copies the byte range[offset, length]of this file to the range[destinationOffset, length]of the given destination file.voidremoteCopyTo(File destination) Performs a remote file copy of this file to the given file.voidsetLength(long endOfFile) The function for truncate or set file length for a filetoString()longwrite(byte[] buffer, long fileOffset) Write the data in buffer to this file at position fileOffset.longwrite(byte[] buffer, long fileOffset, int offset, int length) Write the data in buffer to this file at position fileOffset.longwrite(ByteChunkProvider provider) Write all available data from the byte chunk provider to this file.longwrite(ByteChunkProvider provider, ProgressListener progressListener) Write all available data from the byte chunk provider to this file.longwrite(ByteBuffer buffer, long fileOffset) Write the data in aByteBufferto this file at position fileOffset.writeAsync(byte[] buffer, long fileOffset, int offset, int length) Write the data Async in buffer to this file at position fileOffset.writeAsync(ByteChunkProvider provider) Async Write all available data from the byte chunk provider to this file.Methods inherited from class DiskEntry
closeNoWait, createHardlink, createHardlink, deleteOnClose, equals, flush, getDiskShare, getFileInformation, getFileInformation, getFileName, getPath, getSecurityInformation, getUncPath, hashCode, ioctl, ioctl, ioctl, rename, rename, rename, setFileInformation, setSecurityInformation, setSecurityInformationMethods inherited from class Open
close, closeSilently, getFileId, requestLock
-
Method Details
-
write
public long write(byte[] buffer, long fileOffset) Write the data in buffer to this file at position fileOffset.- Parameters:
buffer- the data to writefileOffset- The offset, in bytes, into the file to which the data should be written- Returns:
- the actual number of bytes that was written to the file
-
write
public long write(byte[] buffer, long fileOffset, int offset, int length) Write the data in buffer to this file at position fileOffset.- Parameters:
buffer- the data to writefileOffset- The offset, in bytes, into the file to which the data should be writtenoffset- the start offset in the datalength- the number of bytes that are written- Returns:
- the actual number of bytes that was written to the file
-
write
Write all available data from the byte chunk provider to this file. The offset in the file to which data is written is determined byByteChunkProvider.getOffset().- Parameters:
provider- the byte chunk provider- Returns:
- the actual number of bytes that was written to the file
-
write
Write all available data from the byte chunk provider to this file. The offset in the file to which data is written is determined byByteChunkProvider.getOffset().- Parameters:
provider- the byte chunk providerprogressListener- an optional callback that will be invoked when data has been written to the file- Returns:
- the actual number of bytes that was written to the file
-
writeAsync
Write the data Async in buffer to this file at position fileOffset.- Parameters:
buffer- the data to writefileOffset- The offset, in bytes, into the file to which the data should be writtenoffset- the start offset in the datalength- the number of bytes that are written- Returns:
- A Future containing the total number of bytes written to the remote.
-
writeAsync
Async Write all available data from the byte chunk provider to this file. The offset in the file to which data is written is determined byByteChunkProvider.getOffset().- Parameters:
provider- the byte chunk provider- Returns:
- A future containing the total number of bytes written to the remote.
-
getOutputStream
-
getOutputStream
-
getOutputStream
-
getOutputStream
-
read
public int read(byte[] buffer, long fileOffset) Read data from this file starting at position fileOffset into the given buffer.- Parameters:
buffer- the buffer to write intofileOffset- The offset, in bytes, into the file from which the data should be read- Returns:
- the actual number of bytes that were read; or -1 if the end of the file was reached
-
read
public int read(byte[] buffer, long fileOffset, int offset, int length) Read data from this file starting at position fileOffset into the given buffer.- Parameters:
buffer- the buffer to write intofileOffset- The offset, in bytes, into the file from which the data should be readoffset- the start offset in the buffer at which to write datalength- the maximum number of bytes to read- Returns:
- the actual number of bytes that were read; or -1 if the end of the file was reached
-
read
- Throws:
IOException
-
read
- Throws:
IOException
-
write
Write the data in aByteBufferto this file at position fileOffset.- Parameters:
buffer- the data to writefileOffset- The offset, in bytes, into the file to which the data should be written- Returns:
- the actual number of bytes that was written to the file
-
read
Read data from this file starting at position fileOffset into the givenByteBuffer.- Parameters:
buffer- theByteBufferto write intofileOffset- The offset, in bytes, into the file from which the data should be read- Returns:
- the actual number of bytes that were read; or -1 if the end of the file was reached
-
setLength
The function for truncate or set file length for a file- Parameters:
endOfFile- 64-bit signed integer in bytes, MUST be greater than or equal to 0- Throws:
SMBApiException
-
getInputStream
-
getInputStream
-
toString
-