Package com.knowgate.jcifs.smb

Examples of com.knowgate.jcifs.smb.SmbFileInputStream


                    line = line.substring( line.indexOf( '\\' ));
                    String url = "smb:" + line.replace( '\\', '/' );

                    if( alt > 0 ) {
                        try {
                            populate( new InputStreamReader( new SmbFileInputStream( url )));
                        } catch( IOException ioe ) {
                            DebugFile.writeln( "lmhosts URL: " + url );
                            new ErrorHandler(ioe);
                            continue;
                        }

                        /* An include was loaded successfully. We can skip
                         * all other includes up to the #END_ALTERNATE tag.
                         */

                        alt--;
                        while(( line = br.readLine() ) != null ) {
                            line = line.toUpperCase().trim();
                            if( line.startsWith( "#END_ALTERNATE" )) {
                                break;
                            }
                        }
                    } else {
                        populate( new InputStreamReader( new SmbFileInputStream( url )));
                    }
                } else if( line.startsWith( "#BEGIN_ALTERNATE" )) {
                    alt++;
                } else if( line.startsWith( "#END_ALTERNATE" ) && alt > 0 ) {
                    alt--;
View Full Code Here


    }

    protected void doFile( HttpServletRequest req,
                HttpServletResponse resp, SmbFile file ) throws IOException {
        byte[] buf = new byte[8192];
        SmbFileInputStream in;
        ServletOutputStream out;
        String url, type;
        int n;

        in = new SmbFileInputStream( file );
        out = resp.getOutputStream();
        url = file.getPath();

        resp.setContentType( "text/plain" );

        if(( n = url.lastIndexOf( '.' )) > 0 &&
                ( type = url.substring( n + 1 )) != null &&
                type.length() > 1 && type.length() < 6 ) {
            resp.setContentType( mimeMap.getMimeType( type ));
        }
        resp.setHeader( "Content-Length", file.length() + "" );
        resp.setHeader( "Accept-Ranges", "Bytes" );

        while(( n = in.read( buf )) != -1 ) {
            out.write( buf, 0, n );
        }
    }
View Full Code Here

TOP

Related Classes of com.knowgate.jcifs.smb.SmbFileInputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.