jcifs.smb

Class SmbNamedPipe


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, FILE_NO_SHARE, FILE_SHARE_DELETE, FILE_SHARE_READ, FILE_SHARE_WRITE, TYPE_COMM, TYPE_FILESYSTEM, TYPE_NAMED_PIPE, TYPE_PRINTER, TYPE_SERVER, TYPE_SHARE, TYPE_WORKGROUP

Constructor Summary

SmbNamedPipe(String url, int pipeType)
Open the Named Pipe resource specified by the url parameter.
SmbNamedPipe(String url, int pipeType, NtlmPasswordAuthentication auth)
SmbNamedPipe(URL url, int pipeType, NtlmPasswordAuthentication auth)

Method Summary

InputStream
getNamedPipeInputStream()
Return the InputStream used to read information from this pipe instance.
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, getServer, getShare, getType, getUncPath, hashCode, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listFiles, mkdir, mkdirs, renameTo, setAttributes, setCreateTime, setLastModified, setReadOnly, setReadWrite, toString, toURL

Field Details

PIPE_TYPE_CALL

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

Field Value:
1


PIPE_TYPE_DCE_TRANSACT

public static final int PIPE_TYPE_DCE_TRANSACT

Field Value:
6


PIPE_TYPE_RDONLY

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

Field Value:
65536


PIPE_TYPE_RDWR

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

Field Value:
196608


PIPE_TYPE_TRANSACT

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

Field Value:
2


PIPE_TYPE_WRONLY

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

Field Value:
131072

Constructor Details

SmbNamedPipe

public SmbNamedPipe(String url,
                    int pipeType)
            throws MalformedURLException,
                   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(String url,
                    int pipeType,
                    NtlmPasswordAuthentication auth)
            throws MalformedURLException,
                   UnknownHostException


SmbNamedPipe

public SmbNamedPipe(URL url,
                    int pipeType,
                    NtlmPasswordAuthentication auth)
            throws MalformedURLException,
                   UnknownHostException

Method Details

getNamedPipeInputStream

public InputStream getNamedPipeInputStream()
            throws 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.


getNamedPipeOutputStream

public OutputStream getNamedPipeOutputStream()
            throws 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).