java.lang.Object
java.net.URLConnection
org.codelibs.jcifs.smb.impl.SmbFile
org.codelibs.jcifs.smb.impl.SmbNamedPipe
- All Implemented Interfaces:
AutoCloseable,SmbConstants,SmbPipeResource,SmbResource
This class will allow a Java program to read and write data to Named
Pipes and Transact NamedPipes.
There are three Win32 function calls provided by the Windows SDK that are important in the context of using jCIFS. They are:
CallNamedPipeA message-type pipe call that opens, writes to, reads from, and closes the pipe in a single operation.TransactNamedPipeA message-type pipe call that writes to and reads from an existing pipe descriptor in one operation.CreateFile,ReadFile,WriteFile, andCloseFileA byte-type pipe can be opened, written to, read from and closed using the standard Win32 file operations.
The jCIFS API maps all of these operations into the standard Java
XxxputStream interface. A special PIPE_TYPE
flags is necessary to distinguish which type of Named Pipe behavior
is desired.
SmbNamedPipe Constructor Examples |
|
| Code Sample | Description |
new SmbNamedPipe("smb://server/IPC$/PIPE/foo", SmbNamedPipe.PIPE_TYPE_RDWR | SmbNamedPipe.PIPE_TYPE_CALL, context);
|
Open the Named Pipe foo for reading and writing. The pipe will behave like the CallNamedPipe interface.
|
new SmbNamedPipe("smb://server/IPC$/foo", SmbNamedPipe.PIPE_TYPE_RDWR | SmbNamedPipe.PIPE_TYPE_TRANSACT, context);
|
Open the Named Pipe foo for reading and writing. The pipe will behave like the TransactNamedPipe
interface.
|
new SmbNamedPipe("smb://server/IPC$/foo", SmbNamedPipe.PIPE_TYPE_RDWR, context);
|
Open the Named Pipe foo for reading and writing. The pipe will
behave as though the CreateFile, ReadFile,
WriteFile, and CloseFile interface was
being used.
|
See Using jCIFS to Connect to Win32 Named Pipes for a detailed description of how to use jCIFS with Win32 Named Pipe server processes.
-
Field Summary
Fields inherited from class org.codelibs.jcifs.smb.impl.SmbFile
ATTR_GET_MASK, ATTR_SET_MASK, DEFAULT_ATTR_EXPIRATION_PERIOD, fileLocator, HASH_DOT, HASH_DOT_DOTFields inherited from class java.net.URLConnection
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCachesFields inherited from interface org.codelibs.jcifs.smb.SmbConstants
ATTR_ARCHIVE, ATTR_COMPRESSED, ATTR_DIRECTORY, ATTR_HIDDEN, ATTR_NORMAL, ATTR_READONLY, ATTR_SYSTEM, ATTR_TEMPORARY, ATTR_VOLUME, CAP_DFS, CAP_EXTENDED_SECURITY, CAP_LARGE_FILES, CAP_LARGE_READX, CAP_LARGE_WRITEX, CAP_LEVEL_II_OPLOCKS, CAP_LOCK_AND_READ, CAP_MPX_MODE, CAP_NONE, CAP_NT_FIND, CAP_NT_SMBS, CAP_RAW_MODE, CAP_RPC_REMOTE_APIS, CAP_STATUS32, CAP_UNICODE, CMD_OFFSET, DEFAULT_CONN_TIMEOUT, DEFAULT_MAX_MPX_COUNT, DEFAULT_NOTIFY_BUF_SIZE, DEFAULT_OEM_ENCODING, DEFAULT_PORT, DEFAULT_RCV_BUF_SIZE, DEFAULT_RESPONSE_TIMEOUT, DEFAULT_SHARING, DEFAULT_SND_BUF_SIZE, DEFAULT_SO_TIMEOUT, DEFAULT_SSN_LIMIT, DELETE, ERROR_CODE_OFFSET, FILE_APPEND_DATA, FILE_DELETE, FILE_EXECUTE, FILE_NO_SHARE, FILE_READ_ATTRIBUTES, FILE_READ_DATA, FILE_READ_EA, FILE_SHARE_DELETE, FILE_SHARE_READ, FILE_SHARE_WRITE, FILE_WRITE_ATTRIBUTES, FILE_WRITE_DATA, FILE_WRITE_EA, FLAGS_COPY_SOURCE_MODE_ASCII, FLAGS_COPY_TARGET_MODE_ASCII, FLAGS_LOCK_AND_READ_WRITE_AND_UNLOCK, FLAGS_NONE, FLAGS_NOTIFY_OF_MODIFY_ACTION, FLAGS_OFFSET, FLAGS_OPLOCK_REQUESTED_OR_GRANTED, FLAGS_PATH_NAMES_CANONICALIZED, FLAGS_PATH_NAMES_CASELESS, FLAGS_RECEIVE_BUFFER_POSTED, FLAGS_RESPONSE, FLAGS_TARGET_MUST_BE_DIRECTORY, FLAGS_TARGET_MUST_BE_FILE, FLAGS_TREE_COPY, FLAGS_VERIFY_ALL_WRITES, FLAGS2_EXTENDED_ATTRIBUTES, FLAGS2_EXTENDED_SECURITY_NEGOTIATION, FLAGS2_LONG_FILENAMES, FLAGS2_NONE, FLAGS2_PERMIT_READ_IF_EXECUTE_PERM, FLAGS2_RESOLVE_PATHS_IN_DFS, FLAGS2_SECURITY_REQUIRE_SIGNATURES, FLAGS2_SECURITY_SIGNATURES, FLAGS2_STATUS32, FLAGS2_UNICODE, FOREVER, GENERIC_ALL, GENERIC_EXECUTE, GENERIC_READ, GENERIC_WRITE, MILLISECONDS_BETWEEN_1970_AND_1601, O_APPEND, O_CREAT, O_EXCL, O_RDONLY, O_RDWR, O_TRUNC, O_WRONLY, OPEN_FUNCTION_FAIL_IF_EXISTS, OPEN_FUNCTION_OVERWRITE_IF_EXISTS, READ_CONTROL, SECURITY_SHARE, SECURITY_USER, SIGNATURE_OFFSET, SMB1_HEADER_LENGTH, SYNCHRONIZE, TID_OFFSET, TYPE_COMM, TYPE_FILESYSTEM, TYPE_NAMED_PIPE, TYPE_PRINTER, TYPE_SERVER, TYPE_SHARE, TYPE_WORKGROUP, WRITE_DAC, WRITE_OWNERFields inherited from interface org.codelibs.jcifs.smb.SmbPipeResource
PIPE_TYPE_CALL, PIPE_TYPE_DCE_TRANSACT, PIPE_TYPE_RDONLY, PIPE_TYPE_RDWR, PIPE_TYPE_TRANSACT, PIPE_TYPE_UNSHARED, PIPE_TYPE_WRONLY -
Constructor Summary
ConstructorsConstructorDescriptionSmbNamedPipe(String url, int pipeType, boolean unshared, CIFSContext tc) Open the Named Pipe resource specified by the url parameter.SmbNamedPipe(String url, int pipeType, CIFSContext tc) Open the Named Pipe resource specified by the url parameter. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcustomizeCreate(SmbComNTCreateAndX request, SmbComNTCreateAndXResponse response) Customizes the NT create request and response for subclass-specific behaviorintGets the type of this pipe.intgetType()Returns type of of object thisSmbResourcerepresents.openPipe()Create a pipe handleMethods inherited from class org.codelibs.jcifs.smb.impl.SmbFile
canRead, canWrite, children, children, children, children, close, connect, copyTo, createNewFile, createTime, delete, equals, exists, fileIndex, getAttributes, getCanonicalPath, getCanonicalUncPath, getContentLength, getContentLengthLong, getContext, getDate, getDfsPath, getDiskFreeSpace, getInputStream, getLastModified, getLocator, getName, getOutputStream, getOwnerGroup, getOwnerGroup, getOwnerUser, getOwnerUser, getParent, getPath, getSecurity, getSecurity, getServer, getServerWithDfs, getShare, getShareSecurity, getTransportContext, getTreeHandle, getUncPath, hashCode, isDirectory, isFile, isHidden, lastAccess, lastModified, length, list, list, listFiles, listFiles, listFiles, listFiles, mkdir, mkdirs, openInputStream, openInputStream, openInputStream, openOutputStream, openOutputStream, openOutputStream, openOutputStream, openRandomAccess, openRandomAccess, renameTo, renameTo, resolve, setAttributes, setCreateTime, setFileTimes, setLastAccess, setLastModified, setNonPooled, setReadOnly, setReadWrite, toString, toURL, watch, withOpen, withOpen, withOpenMethods inherited from class java.net.URLConnection
addRequestProperty, getAllowUserInteraction, getConnectTimeout, getContent, getContent, getContentEncoding, getContentType, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, getHeaderFieldLong, getHeaderFields, getIfModifiedSince, getPermission, getReadTimeout, getRequestProperties, getRequestProperty, getURL, getUseCaches, guessContentTypeFromName, guessContentTypeFromStream, setAllowUserInteraction, setConnectTimeout, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setDefaultUseCaches, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setReadTimeout, setRequestProperty, setUseCachesMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.codelibs.jcifs.smb.SmbResource
canRead, canWrite, children, children, children, children, close, copyTo, createNewFile, createTime, delete, exists, fileIndex, getAttributes, getContext, getDiskFreeSpace, getLocator, getName, getOwnerGroup, getOwnerGroup, getOwnerUser, getOwnerUser, getSecurity, getSecurity, getShareSecurity, isDirectory, isFile, isHidden, lastAccess, lastModified, length, mkdir, mkdirs, openInputStream, openInputStream, openInputStream, openOutputStream, openOutputStream, openOutputStream, openOutputStream, openRandomAccess, openRandomAccess, renameTo, renameTo, resolve, setAttributes, setCreateTime, setFileTimes, setLastAccess, setLastModified, setReadOnly, setReadWrite, watch
-
Constructor Details
-
SmbNamedPipe
public SmbNamedPipe(String url, int pipeType, boolean unshared, CIFSContext tc) throws MalformedURLException Open the Named Pipe resource specified by the url parameter. The pipeType parameter should be at least one of thePIPE_TYPEflags combined with the bitwise OR operator|. See the examples listed above.- Parameters:
url- the SMB URL for the named pipepipeType- the type of the pipeunshared- whether to use an exclusive connection for this pipetc- the CIFS context to use- Throws:
MalformedURLException- if the URL is not properly formatted
-
SmbNamedPipe
Open the Named Pipe resource specified by the url parameter. The pipeType parameter should be at least one of thePIPE_TYPEflags combined with the bitwise OR operator|. See the examples listed above.- Parameters:
url- the SMB URL for the named pipepipeType- the type of the pipetc- the CIFS context to use- Throws:
MalformedURLException- if the URL is not properly formatted
-
-
Method Details
-
customizeCreate
Customizes the NT create request and response for subclass-specific behavior- Overrides:
customizeCreatein classSmbFile- Parameters:
request- the create request to customizeresponse- the create response to customize- See Also:
-
getType
Returns type of of object thisSmbResourcerepresents.- Specified by:
getTypein interfaceSmbResource- Overrides:
getTypein classSmbFile- Returns:
TYPE_FILESYSTEM, TYPE_WORKGROUP, TYPE_SERVER, TYPE_SHARE, TYPE_PRINTER, TYPE_NAMED_PIPE, orTYPE_COMM.- Throws:
SmbException- See Also:
-
getPipeType
public int getPipeType()Description copied from interface:SmbPipeResourceGets the type of this pipe.- Specified by:
getPipeTypein interfaceSmbPipeResource- Returns:
- the pipe type
-
openPipe
Description copied from interface:SmbPipeResourceCreate a pipe handle- Specified by:
openPipein interfaceSmbPipeResource- Returns:
- a handle for interacting with the pipe
-