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 SMB2Dialectdialectprivate java.util.concurrent.atomic.AtomicBooleandisconnectedprivate static EmptyByteChunkProviderEMPTYprivate intreadBufferSizeprivate longreadTimeoutprivate static SMB2FileIdROOT_IDprotected Sessionsessionprivate longsessionIdprotected SmbPathsmbPathprivate static StatusHandlerSUCCESS_OR_CLOSEDprivate static StatusHandlerSUCCESS_OR_EOFprivate static StatusHandlerSUCCESS_OR_NO_MORE_FILES_OR_NO_SUCH_FILEprivate static StatusHandlerSUCCESS_OR_SYMLINKprivate inttransactBufferSizeprivate longtransactTimeoutprotected TreeConnecttreeConnectprivate longtreeIdprivate intwriteBufferSizeprivate longwriteTimeout
-
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)voidclose()(package private) voidcloseFileId(SMB2FileId fileId)(package private) java.util.concurrent.Future<SMB2Close>closeFileIdNoWait(SMB2FileId fileId)(package private) SMB2CreateResponsecreateFile(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)booleanequals(java.lang.Object obj)(package private) voidflush(SMB2FileId fileId)protected StatusHandlergetCreateStatusHandler()(package private) SMB2DialectgetDialect()(package private) intgetReadBufferSize()(package private) longgetReadTimeout()SmbPathgetSmbPath()TreeConnectgetTreeConnect()(package private) intgetWriteBufferSize()inthashCode()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.intioctl(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) intioctl(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) SMB2IoctlResponseioctl(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)booleanisConnected()(package private) SMB2FileIdopenFileId(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) SMB2QueryDirectoryResponsequeryDirectory(SMB2FileId fileId, java.util.Set<SMB2QueryDirectoryRequest.SMB2QueryDirectoryFlags> flags, FileInformationClass informationClass, java.lang.String searchPattern)SMB2QueryInfoResponsequeryInfo(SMB2FileId fileId, SMB2QueryInfoRequest.SMB2QueryInfoType infoType, java.util.Set<SecurityInformation> securityInfo, FileInformationClass fileInformationClass, FileSystemInformationClass fileSystemInformationClass)(package private) SMB2ReadResponseread(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) SMB2LockResponsesendLockRequest(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) voidsetInfo(SMB2FileId fileId, SMB2SetInfoRequest.SMB2InfoType infoType, java.util.Set<SecurityInformation> securityInfo, FileInformationClass fileInformationClass, byte[] buffer)(package private) SMB2WriteResponsewrite(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:
closein 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
public 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
nullif 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 ininDatawhere the input data startsinLength- the number of bytes frominDatato send, starting atoffset- Returns:
- the response data or
nullif 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 ininDatawhere the input data startsinLength- the number of bytes frominDatato send, starting atinOffsetoutData- the buffer where the response data should be writtenoutOffset- the offset inoutDatawhere 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:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-