1 19 20 package com.knowgate.jcifs.smb; 21 22 import java.net.URL ; 23 import java.io.IOException ; 24 import java.io.InputStream ; 25 import java.io.OutputStream ; 26 import java.net.MalformedURLException ; 27 import java.net.UnknownHostException ; 28 29 86 87 public class SmbNamedPipe extends SmbFile { 88 89 92 93 public static final int PIPE_TYPE_RDONLY = O_RDONLY; 94 95 98 99 public static final int PIPE_TYPE_WRONLY = O_WRONLY; 100 101 104 105 public static final int PIPE_TYPE_RDWR = O_RDWR; 106 107 110 111 public static final int PIPE_TYPE_CALL = 0x01; 112 113 116 117 public static final int PIPE_TYPE_TRANSACT = 0x02; 118 119 InputStream pipeIn; 120 OutputStream pipeOut; 121 int pipeType; 122 123 129 130 public SmbNamedPipe( String url, int pipeType ) 131 throws MalformedURLException , UnknownHostException { 132 super( url ); 133 this.pipeType = pipeType; 134 type = TYPE_NAMED_PIPE; 135 } 136 public SmbNamedPipe( String url, int pipeType, NtlmPasswordAuthentication auth ) 137 throws MalformedURLException , UnknownHostException { 138 super( url, auth ); 139 this.pipeType = pipeType; 140 type = TYPE_NAMED_PIPE; 141 } 142 public SmbNamedPipe( URL url, int pipeType, NtlmPasswordAuthentication auth ) 143 throws MalformedURLException , UnknownHostException { 144 super( url, auth ); 145 this.pipeType = pipeType; 146 type = TYPE_NAMED_PIPE; 147 } 148 149 159 160 public InputStream getNamedPipeInputStream() throws IOException { 161 if( pipeIn == null ) { 162 if(( pipeType & PIPE_TYPE_CALL ) == PIPE_TYPE_CALL || 163 ( pipeType & PIPE_TYPE_TRANSACT ) == PIPE_TYPE_TRANSACT ) { 164 pipeIn = new TransactNamedPipeInputStream( this ); 165 } else { 166 pipeIn = new SmbFileInputStream( this, 167 ( pipeType & 0xFF0000 ) | SmbFile.O_EXCL ); 168 } 169 } 170 return pipeIn; 171 } 172 173 180 181 public OutputStream getNamedPipeOutputStream() throws IOException { 182 if( pipeOut == null ) { 183 if(( pipeType & PIPE_TYPE_CALL ) == PIPE_TYPE_CALL || 184 ( pipeType & PIPE_TYPE_TRANSACT ) == PIPE_TYPE_TRANSACT ) { 185 pipeOut = new TransactNamedPipeOutputStream( this ); 186 } else { 187 pipeOut = new SmbFileOutputStream( this, false, 188 ( pipeType & 0xFF0000 ) | SmbFile.O_EXCL ); 189 } 190 } 191 return pipeOut; 192 } 193 } 194 | Popular Tags |