Package jcifs.smb
Class SmbNamedPipe
- java.lang.Object
-
- java.net.URLConnection
-
- jcifs.smb.SmbFile
-
- jcifs.smb.SmbNamedPipe
-
- All Implemented Interfaces:
AutoCloseable
,SmbConstants
,SmbPipeResource
,SmbResource
public class SmbNamedPipe extends SmbFile implements SmbPipeResource
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:
CallNamedPipe
A message-type pipe call that opens, writes to, reads from, and closes the pipe in a single operation.TransactNamedPipe
A message-type pipe call that writes to and reads from an existing pipe descriptor in one operation.CreateFile
,ReadFile
,WriteFile
, andCloseFile
A 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 specialPIPE_TYPE
flags is necessary to distinguish which type of Named Pipe behavior is desired.SmbNamedPipe
Constructor ExamplesCode 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
, andCloseFile
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 jcifs.smb.SmbFile
ATTR_GET_MASK, ATTR_SET_MASK, DEFAULT_ATTR_EXPIRATION_PERIOD, fileLocator, HASH_DOT, HASH_DOT_DOT
-
Fields inherited from class java.net.URLConnection
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches
-
Fields inherited from interface jcifs.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_OWNER
-
Fields inherited from interface jcifs.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
Constructors Constructor Description SmbNamedPipe(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
customizeCreate(SmbComNTCreateAndX request, SmbComNTCreateAndXResponse response)
int
getPipeType()
int
getType()
Returns type of of object this SmbResource represents.SmbPipeHandle
openPipe()
Create a pipe handle-
Methods inherited from class jcifs.smb.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, withOpen
-
Methods 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, setUseCaches
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jcifs.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 Detail
-
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_TYPE
flags combined with the bitwise OR operator|
. See the examples listed above.- Parameters:
url
-pipeType
-unshared
- whether to use an exclusive connection for this pipetc
-- Throws:
MalformedURLException
-
SmbNamedPipe
public SmbNamedPipe(String url, int pipeType, CIFSContext tc) throws MalformedURLException
Open the Named Pipe resource specified by the url parameter. The pipeType parameter should be at least one of thePIPE_TYPE
flags combined with the bitwise OR operator|
. See the examples listed above.- Parameters:
url
-pipeType
-tc
-- Throws:
MalformedURLException
-
-
Method Detail
-
customizeCreate
protected void customizeCreate(SmbComNTCreateAndX request, SmbComNTCreateAndXResponse response)
-
getType
public int getType() throws SmbException
Returns type of of object this SmbResource represents.- Specified by:
getType
in interfaceSmbResource
- Overrides:
getType
in classSmbFile
- Returns:
- TYPE_FILESYSTEM, TYPE_WORKGROUP, TYPE_SERVER, TYPE_SHARE, TYPE_PRINTER, TYPE_NAMED_PIPE, or TYPE_COMM.
- Throws:
SmbException
- See Also:
SmbFile.getType()
-
getPipeType
public int getPipeType()
- Specified by:
getPipeType
in interfaceSmbPipeResource
- Returns:
- the pipe type
-
openPipe
public SmbPipeHandle openPipe()
Description copied from interface:SmbPipeResource
Create a pipe handle- Specified by:
openPipe
in interfaceSmbPipeResource
- Returns:
- a handle for interacting with the pipe
-
-