Package com.hierynomus.smbj.share
Class Share
- java.lang.Object
-
- com.hierynomus.smbj.share.Share
-
- All Implemented Interfaces:
java.lang.AutoCloseable
- Direct Known Subclasses:
DiskShare
,PipeShare
,PrinterShare
public class Share extends java.lang.Object implements java.lang.AutoCloseable
-
-
Field Summary
Fields Modifier and Type Field Description private SMB2Dialect
dialect
private java.util.concurrent.atomic.AtomicBoolean
disconnected
private static EmptyByteChunkProvider
EMPTY
private int
readBufferSize
private long
readTimeout
private static SMB2FileId
ROOT_ID
protected Session
session
private long
sessionId
protected SmbPath
smbPath
private static StatusHandler
SUCCESS_OR_CLOSED
private static StatusHandler
SUCCESS_OR_EOF
private static StatusHandler
SUCCESS_OR_NO_MORE_FILES_OR_NO_SUCH_FILE
private static StatusHandler
SUCCESS_OR_SYMLINK
private int
transactBufferSize
private long
transactTimeout
protected TreeConnect
treeConnect
private long
treeId
private int
writeBufferSize
private long
writeTimeout
-
Constructor Summary
Constructors Constructor Description Share(SmbPath smbPath, TreeConnect treeConnect)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) java.util.concurrent.Future<SMB2ChangeNotifyResponse>
changeNotifyAsync(SMB2FileId fileId, java.util.Set<SMB2CompletionFilter> completionFilter, java.util.Set<SMB2ChangeNotifyFlags> flags)
void
close()
(package private) void
closeFileId(SMB2FileId fileId)
(package private) java.util.concurrent.Future<SMB2Close>
closeFileIdNoWait(SMB2FileId fileId)
(package private) SMB2CreateResponse
createFile(SmbPath path, SMB2ImpersonationLevel impersonationLevel, java.util.Set<AccessMask> accessMask, java.util.Set<FileAttributes> fileAttributes, java.util.Set<SMB2ShareAccess> shareAccess, SMB2CreateDisposition createDisposition, java.util.Set<SMB2CreateOptions> createOptions)
boolean
equals(java.lang.Object obj)
(package private) void
flush(SMB2FileId fileId)
protected StatusHandler
getCreateStatusHandler()
(package private) SMB2Dialect
getDialect()
(package private) int
getReadBufferSize()
(package private) long
getReadTimeout()
SmbPath
getSmbPath()
TreeConnect
getTreeConnect()
(package private) int
getWriteBufferSize()
int
hashCode()
byte[]
ioctl(long ctlCode, boolean isFsCtl, byte[] inData)
Sends a control code directly to a specified device driver, causing the corresponding device to perform the corresponding operation.byte[]
ioctl(long ctlCode, boolean isFsCtl, byte[] inData, int inOffset, int inLength)
Sends a control code directly to a specified device driver, causing the corresponding device to perform the corresponding operation.int
ioctl(long ctlCode, boolean isFsCtl, byte[] inData, int inOffset, int inLength, byte[] outData, int outOffset, int outLength)
Sends a control code directly to a specified device driver, causing the corresponding device to perform the corresponding operation.(package private) byte[]
ioctl(SMB2FileId fileId, long ctlCode, boolean isFsCtl, byte[] inData, int inOffset, int inLength)
(package private) int
ioctl(SMB2FileId fileId, long ctlCode, boolean isFsCtl, byte[] inData, int inOffset, int inLength, byte[] outData, int outOffset, int outLength)
(package private) byte[]
ioctl(SMB2FileId fileId, long ctlCode, boolean isFsCtl, byte[] inData, int inOffset, int inLength, int maxOutputResponse)
(package private) SMB2IoctlResponse
ioctl(SMB2FileId fileId, long ctlCode, boolean isFsCtl, ByteChunkProvider inputData, int maxOutputResponse)
java.util.concurrent.Future<SMB2IoctlResponse>
ioctlAsync(long ctlCode, boolean isFsCtl, ByteChunkProvider inputData)
(package private) java.util.concurrent.Future<SMB2IoctlResponse>
ioctlAsync(SMB2FileId fileId, long ctlCode, boolean isFsCtl, ByteChunkProvider inputData, int maxOutputResponse)
boolean
isConnected()
(package private) SMB2FileId
openFileId(SmbPath path, SMB2ImpersonationLevel impersonationLevel, java.util.Set<AccessMask> accessMask, java.util.Set<FileAttributes> fileAttributes, java.util.Set<SMB2ShareAccess> shareAccess, SMB2CreateDisposition createDisposition, java.util.Set<SMB2CreateOptions> createOptions)
(package private) SMB2QueryDirectoryResponse
queryDirectory(SMB2FileId fileId, java.util.Set<SMB2QueryDirectoryRequest.SMB2QueryDirectoryFlags> flags, FileInformationClass informationClass, java.lang.String searchPattern)
(package private) SMB2QueryInfoResponse
queryInfo(SMB2FileId fileId, SMB2QueryInfoRequest.SMB2QueryInfoType infoType, java.util.Set<SecurityInformation> securityInfo, FileInformationClass fileInformationClass, FileSystemInformationClass fileSystemInformationClass)
(package private) SMB2ReadResponse
read(SMB2FileId fileId, long offset, int length)
(package private) java.util.concurrent.Future<SMB2ReadResponse>
readAsync(SMB2FileId fileId, long offset, int length)
(package private) <T extends SMB2Packet>
Treceive(java.util.concurrent.Future<T> fut, long timeout)
(package private) <T extends SMB2Packet>
Treceive(java.util.concurrent.Future<T> fut, java.lang.String name, java.lang.Object target, StatusHandler statusHandler, long timeout)
private <T extends SMB2Packet>
java.util.concurrent.Future<T>send(SMB2Packet request)
(package private) SMB2LockResponse
sendLockRequest(SMB2FileId fileId, short lockSequenceNumber, int lockSequenceIndex, java.util.List<SMB2LockElement> lockElements)
private <T extends SMB2Packet>
TsendReceive(SMB2Packet request, java.lang.String name, java.lang.Object target, StatusHandler statusHandler, long timeout)
(package private) void
setInfo(SMB2FileId fileId, SMB2SetInfoRequest.SMB2InfoType infoType, java.util.Set<SecurityInformation> securityInfo, FileInformationClass fileInformationClass, byte[] buffer)
(package private) SMB2WriteResponse
write(SMB2FileId fileId, ByteChunkProvider provider)
(package private) java.util.concurrent.Future<SMB2WriteResponse>
writeAsync(SMB2FileId fileId, ByteChunkProvider provider)
-
-
-
Field Detail
-
ROOT_ID
private static final SMB2FileId ROOT_ID
-
SUCCESS_OR_SYMLINK
private static final StatusHandler SUCCESS_OR_SYMLINK
-
SUCCESS_OR_NO_MORE_FILES_OR_NO_SUCH_FILE
private static final StatusHandler SUCCESS_OR_NO_MORE_FILES_OR_NO_SUCH_FILE
-
SUCCESS_OR_EOF
private static final StatusHandler SUCCESS_OR_EOF
-
SUCCESS_OR_CLOSED
private static final StatusHandler SUCCESS_OR_CLOSED
-
smbPath
protected final SmbPath smbPath
-
treeConnect
protected final TreeConnect treeConnect
-
treeId
private final long treeId
-
session
protected Session session
-
dialect
private final SMB2Dialect dialect
-
readBufferSize
private final int readBufferSize
-
readTimeout
private final long readTimeout
-
writeBufferSize
private final int writeBufferSize
-
writeTimeout
private final long writeTimeout
-
transactBufferSize
private final int transactBufferSize
-
transactTimeout
private final long transactTimeout
-
sessionId
private final long sessionId
-
disconnected
private final java.util.concurrent.atomic.AtomicBoolean disconnected
-
EMPTY
private static final EmptyByteChunkProvider EMPTY
-
-
Constructor Detail
-
Share
Share(SmbPath smbPath, TreeConnect treeConnect)
-
-
Method Detail
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Throws:
java.io.IOException
-
isConnected
public boolean isConnected()
-
getSmbPath
public SmbPath getSmbPath()
-
getTreeConnect
public TreeConnect getTreeConnect()
-
getReadBufferSize
int getReadBufferSize()
-
getReadTimeout
long getReadTimeout()
-
getWriteBufferSize
int getWriteBufferSize()
-
openFileId
SMB2FileId openFileId(SmbPath path, SMB2ImpersonationLevel impersonationLevel, java.util.Set<AccessMask> accessMask, java.util.Set<FileAttributes> fileAttributes, java.util.Set<SMB2ShareAccess> shareAccess, SMB2CreateDisposition createDisposition, java.util.Set<SMB2CreateOptions> createOptions)
-
createFile
SMB2CreateResponse createFile(SmbPath path, SMB2ImpersonationLevel impersonationLevel, java.util.Set<AccessMask> accessMask, java.util.Set<FileAttributes> fileAttributes, java.util.Set<SMB2ShareAccess> shareAccess, SMB2CreateDisposition createDisposition, java.util.Set<SMB2CreateOptions> createOptions)
-
getCreateStatusHandler
protected StatusHandler getCreateStatusHandler()
-
flush
void flush(SMB2FileId fileId) throws SMBApiException
- Throws:
SMBApiException
-
closeFileId
void closeFileId(SMB2FileId fileId) throws SMBApiException
- Throws:
SMBApiException
-
closeFileIdNoWait
java.util.concurrent.Future<SMB2Close> closeFileIdNoWait(SMB2FileId fileId) throws SMBApiException
- Throws:
SMBApiException
-
queryInfo
SMB2QueryInfoResponse queryInfo(SMB2FileId fileId, SMB2QueryInfoRequest.SMB2QueryInfoType infoType, java.util.Set<SecurityInformation> securityInfo, FileInformationClass fileInformationClass, FileSystemInformationClass fileSystemInformationClass)
-
setInfo
void setInfo(SMB2FileId fileId, SMB2SetInfoRequest.SMB2InfoType infoType, java.util.Set<SecurityInformation> securityInfo, FileInformationClass fileInformationClass, byte[] buffer)
-
queryDirectory
SMB2QueryDirectoryResponse queryDirectory(SMB2FileId fileId, java.util.Set<SMB2QueryDirectoryRequest.SMB2QueryDirectoryFlags> flags, FileInformationClass informationClass, java.lang.String searchPattern)
-
write
SMB2WriteResponse write(SMB2FileId fileId, ByteChunkProvider provider)
-
writeAsync
java.util.concurrent.Future<SMB2WriteResponse> writeAsync(SMB2FileId fileId, ByteChunkProvider provider)
-
read
SMB2ReadResponse read(SMB2FileId fileId, long offset, int length)
-
readAsync
java.util.concurrent.Future<SMB2ReadResponse> readAsync(SMB2FileId fileId, long offset, int length)
-
ioctl
public byte[] ioctl(long ctlCode, boolean isFsCtl, byte[] inData)
Sends a control code directly to a specified device driver, causing the corresponding device to perform the corresponding operation.- Parameters:
ctlCode
- the control codeisFsCtl
- true if the control code is an FSCTL; false if it is an IOCTLinData
- the control code dependent input data- Returns:
- the response data or
null
if the control code did not produce a response
-
ioctl
public byte[] ioctl(long ctlCode, boolean isFsCtl, byte[] inData, int inOffset, int inLength)
Sends a control code directly to a specified device driver, causing the corresponding device to perform the corresponding operation.- Parameters:
ctlCode
- the control codeisFsCtl
- true if the control code is an FSCTL; false if it is an IOCTLinData
- the control code dependent input datainOffset
- the offset ininData
where the input data startsinLength
- the number of bytes frominData
to send, starting atoffset
- Returns:
- the response data or
null
if the control code did not produce a response
-
ioctl
public int ioctl(long ctlCode, boolean isFsCtl, byte[] inData, int inOffset, int inLength, byte[] outData, int outOffset, int outLength)
Sends a control code directly to a specified device driver, causing the corresponding device to perform the corresponding operation.- Parameters:
ctlCode
- the control codeisFsCtl
- true if the control code is an FSCTL; false if it is an IOCTLinData
- the control code dependent input datainOffset
- the offset ininData
where the input data startsinLength
- the number of bytes frominData
to send, starting atinOffset
outData
- the buffer where the response data should be writtenoutOffset
- the offset inoutData
where the output data should be writtenoutLength
- the maximum amount of data to write inoutData
, starting atoutOffset
- Returns:
- the number of bytes written to
outData
-
ioctl
byte[] ioctl(SMB2FileId fileId, long ctlCode, boolean isFsCtl, byte[] inData, int inOffset, int inLength)
-
ioctl
byte[] ioctl(SMB2FileId fileId, long ctlCode, boolean isFsCtl, byte[] inData, int inOffset, int inLength, int maxOutputResponse)
-
ioctl
int ioctl(SMB2FileId fileId, long ctlCode, boolean isFsCtl, byte[] inData, int inOffset, int inLength, byte[] outData, int outOffset, int outLength)
-
ioctl
SMB2IoctlResponse ioctl(SMB2FileId fileId, long ctlCode, boolean isFsCtl, ByteChunkProvider inputData, int maxOutputResponse)
-
ioctlAsync
public java.util.concurrent.Future<SMB2IoctlResponse> ioctlAsync(long ctlCode, boolean isFsCtl, ByteChunkProvider inputData)
-
ioctlAsync
java.util.concurrent.Future<SMB2IoctlResponse> ioctlAsync(SMB2FileId fileId, long ctlCode, boolean isFsCtl, ByteChunkProvider inputData, int maxOutputResponse)
-
sendLockRequest
SMB2LockResponse sendLockRequest(SMB2FileId fileId, short lockSequenceNumber, int lockSequenceIndex, java.util.List<SMB2LockElement> lockElements)
-
changeNotifyAsync
java.util.concurrent.Future<SMB2ChangeNotifyResponse> changeNotifyAsync(SMB2FileId fileId, java.util.Set<SMB2CompletionFilter> completionFilter, java.util.Set<SMB2ChangeNotifyFlags> flags)
-
sendReceive
private <T extends SMB2Packet> T sendReceive(SMB2Packet request, java.lang.String name, java.lang.Object target, StatusHandler statusHandler, long timeout)
-
send
private <T extends SMB2Packet> java.util.concurrent.Future<T> send(SMB2Packet request)
-
receive
<T extends SMB2Packet> T receive(java.util.concurrent.Future<T> fut, java.lang.String name, java.lang.Object target, StatusHandler statusHandler, long timeout)
-
receive
<T extends SMB2Packet> T receive(java.util.concurrent.Future<T> fut, long timeout)
-
getDialect
SMB2Dialect getDialect()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-