1 19 20 package 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 public static final int PIPE_TYPE_DCE_TRANSACT = 0x02 | 0x04; 120 121 InputStream pipeIn; 122 OutputStream pipeOut; 123 int pipeType; 124 125 131 132 public SmbNamedPipe( String url, int pipeType ) 133 throws MalformedURLException , UnknownHostException { 134 super( url ); 135 this.pipeType = pipeType; 136 type = TYPE_NAMED_PIPE; 137 } 138 public SmbNamedPipe( String url, int pipeType, NtlmPasswordAuthentication auth ) 139 throws MalformedURLException , UnknownHostException { 140 super( url, auth ); 141 this.pipeType = pipeType; 142 type = TYPE_NAMED_PIPE; 143 } 144 public SmbNamedPipe( URL url, int pipeType, NtlmPasswordAuthentication auth ) 145 throws MalformedURLException , UnknownHostException { 146 super( url, auth ); 147 this.pipeType = pipeType; 148 type = TYPE_NAMED_PIPE; 149 } 150 151 161 162 public InputStream getNamedPipeInputStream() throws IOException { 163 if( pipeIn == null ) { 164 if(( pipeType & PIPE_TYPE_CALL ) == PIPE_TYPE_CALL || 165 ( pipeType & PIPE_TYPE_TRANSACT ) == PIPE_TYPE_TRANSACT ) { 166 pipeIn = new TransactNamedPipeInputStream( this ); 167 } else { 168 pipeIn = new SmbFileInputStream( this, 169 ( pipeType & 0xFF0000 ) | SmbFile.O_EXCL ); 170 } 171 } 172 return pipeIn; 173 } 174 175 182 183 public OutputStream getNamedPipeOutputStream() throws IOException { 184 if( pipeOut == null ) { 185 if(( pipeType & PIPE_TYPE_CALL ) == PIPE_TYPE_CALL || 186 ( pipeType & PIPE_TYPE_TRANSACT ) == PIPE_TYPE_TRANSACT ) { 187 pipeOut = new TransactNamedPipeOutputStream( this ); 188 } else { 189 pipeOut = new SmbFileOutputStream( this, false, 190 ( pipeType & 0xFF0000 ) | SmbFile.O_EXCL ); 191 } 192 } 193 return pipeOut; 194 } 195 } 196 | Popular Tags |