jcifs.smb
Class SmbNamedPipe

java.lang.Object
  extended byjava.net.URLConnection
      extended byjcifs.smb.SmbFile
          extended byjcifs.smb.SmbNamedPipe
All Implemented Interfaces:
jcifs.smb.SmbConstants

public class SmbNamedPipe
extends SmbFile

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:

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 SampleDescription
 new SmbNamedPipe( "smb://server/IPC$/PIPE/foo",
         SmbNamedPipe.PIPE_TYPE_RDWR |
         SmbNamedPipe.PIPE_TYPE_CALL );
 
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 );
 
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 );
 
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
static int PIPE_TYPE_CALL
          Pipe operations should behave like the CallNamedPipe Win32 Named Pipe function.
static int PIPE_TYPE_DCE_TRANSACT
           
static int PIPE_TYPE_RDONLY
          The pipe should be opened read-only.
static int PIPE_TYPE_RDWR
          The pipe should be opened for both reading and writing.
static int PIPE_TYPE_TRANSACT
          Pipe operations should behave like the TransactNamedPipe Win32 Named Pipe function.
static int PIPE_TYPE_WRONLY
          The pipe should be opened only for writing.
 
Fields inherited from class jcifs.smb.SmbFile
ATTR_ARCHIVE, ATTR_DIRECTORY, ATTR_HIDDEN, ATTR_READONLY, ATTR_SYSTEM, ATTR_VOLUME, CAP_DFS, CAP_LARGE_FILES, 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, CAPABILITIES, CMD_OFFSET, CONNECTIONS, DEFAULT_CAPABILITIES, DEFAULT_FLAGS2, DEFAULT_MAX_MPX_COUNT, DEFAULT_PORT, DEFAULT_RCV_BUF_SIZE, DEFAULT_RESPONSE_TIMEOUT, 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, 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_SIGNATURES, FLAGS2_STATUS32, FLAGS2_UNICODE, FORCE_UNICODE, GENERIC_ALL, GENERIC_EXECUTE, GENERIC_READ, GENERIC_WRITE, HEADER_LENGTH, LADDR, LPORT, MAX_MPX_COUNT, MILLISECONDS_BETWEEN_1970_AND_1601, NATIVE_LANMAN, NATIVE_OS, NETBIOS_HOSTNAME, NULL_TRANSPORT, OEM_ENCODING, OPEN_FUNCTION_FAIL_IF_EXISTS, OPEN_FUNCTION_OVERWRITE_IF_EXISTS, PID, RCV_BUF_SIZE, READ_CONTROL, RESPONSE_TIMEOUT, SECURITY_SHARE, SECURITY_USER, SIGNATURE_OFFSET, SIGNPREF, SND_BUF_SIZE, SO_TIMEOUT, SSN_LIMIT, SYNCHRONIZE, TCP_NODELAY, TID_OFFSET, TYPE_COMM, TYPE_FILESYSTEM, TYPE_NAMED_PIPE, TYPE_PRINTER, TYPE_SERVER, TYPE_SHARE, TYPE_WORKGROUP, TZ, USE_BATCHING, USE_EXTSEC, USE_NTSMBS, USE_NTSTATUS, USE_UNICODE, VC_NUMBER, WRITE_DAC, WRITE_OWNER
 
Fields inherited from class java.net.URLConnection
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches
 
Constructor Summary
SmbNamedPipe(java.lang.String url, int pipeType)
          Open the Named Pipe resource specified by the url parameter.
SmbNamedPipe(java.lang.String url, int pipeType, NtlmPasswordAuthentication auth)
           
SmbNamedPipe(java.net.URL url, int pipeType, NtlmPasswordAuthentication auth)
           
 
Method Summary
 java.io.InputStream getNamedPipeInputStream()
          Return the InputStream used to read information from this pipe instance.
 java.io.OutputStream getNamedPipeOutputStream()
          Return the OutputStream used to write information to this pipe instance.
 
Methods inherited from class jcifs.smb.SmbFile
canRead, canWrite, connect, copyTo, createNewFile, createTime, delete, equals, exists, getAttributes, getCanonicalPath, getContentLength, getDate, getDfsPath, getDiskFreeSpace, getInputStream, getLastModified, getName, getOutputStream, getParent, getPath, getPrincipal, getSecurity, getSecurity, getServer, getShare, getShareSecurity, getType, getUncPath, hashCode, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listFiles, mkdir, mkdirs, renameTo, setAttributes, setCreateTime, setLastModified, setReadOnly, setReadWrite, toString, toURL
 
Methods inherited from class java.net.URLConnection
addRequestProperty, getAllowUserInteraction, getContent, getContent, getContentEncoding, getContentType, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, getHeaderFields, getIfModifiedSince, getPermission, getRequestProperties, getRequestProperty, getURL, getUseCaches, guessContentTypeFromName, guessContentTypeFromStream, setAllowUserInteraction, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setRequestProperty, setUseCaches
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

PIPE_TYPE_RDONLY

public static final int PIPE_TYPE_RDONLY
The pipe should be opened read-only.

See Also:
Constant Field Values

PIPE_TYPE_WRONLY

public static final int PIPE_TYPE_WRONLY
The pipe should be opened only for writing.

See Also:
Constant Field Values

PIPE_TYPE_RDWR

public static final int PIPE_TYPE_RDWR
The pipe should be opened for both reading and writing.

See Also:
Constant Field Values

PIPE_TYPE_CALL

public static final int PIPE_TYPE_CALL
Pipe operations should behave like the CallNamedPipe Win32 Named Pipe function.

See Also:
Constant Field Values

PIPE_TYPE_TRANSACT

public static final int PIPE_TYPE_TRANSACT
Pipe operations should behave like the TransactNamedPipe Win32 Named Pipe function.

See Also:
Constant Field Values

PIPE_TYPE_DCE_TRANSACT

public static final int PIPE_TYPE_DCE_TRANSACT
See Also:
Constant Field Values
Constructor Detail

SmbNamedPipe

public SmbNamedPipe(java.lang.String url,
                    int pipeType)
             throws java.net.MalformedURLException,
                    java.net.UnknownHostException
Open the Named Pipe resource specified by the url parameter. The pipeType parameter should be at least one of the PIPE_TYPE flags combined with the bitwise OR operator |. See the examples listed above.


SmbNamedPipe

public SmbNamedPipe(java.lang.String url,
                    int pipeType,
                    NtlmPasswordAuthentication auth)
             throws java.net.MalformedURLException,
                    java.net.UnknownHostException

SmbNamedPipe

public SmbNamedPipe(java.net.URL url,
                    int pipeType,
                    NtlmPasswordAuthentication auth)
             throws java.net.MalformedURLException,
                    java.net.UnknownHostException
Method Detail

getNamedPipeInputStream

public java.io.InputStream getNamedPipeInputStream()
                                            throws java.io.IOException
Return the InputStream used to read information from this pipe instance. Presumably data would first be written to the OutputStream associated with this Named Pipe instance although this is not a requirement (e.g. a read-only named pipe would write data to this stream on connection). Reading from this stream may block. Therefore it may be necessary that an addition thread be used to read and write to a Named Pipe.

Throws:
java.io.IOException

getNamedPipeOutputStream

public java.io.OutputStream getNamedPipeOutputStream()
                                              throws java.io.IOException
Return the OutputStream used to write information to this pipe instance. The act of writing data to this stream will result in response data recieved in the InputStream associated with this Named Pipe instance (unless of course it does not elicite a response or the pipe is write-only).

Throws:
java.io.IOException