public String getMimeType( String extension, String def ) throws IOException { int state, t, x, i, off; byte ch; byte[] type = new byte[128]; byte[] buf = new byte[16]; byte[] ext = extension.toLowerCase().getBytes( "ASCII" ); state = ST_START; t = x = i = 0; for( off = 0; off < inLen; off++ ) { ch = in[off]; switch( state ) { case ST_START: if( ch == ' ' || ch == '\t' ) { break; } else if( ch == '#' ) { state = ST_COMM; break; } state = ST_TYPE; case ST_TYPE: if( ch == ' ' || ch == '\t' ) { state = ST_GAP; } else { type[t++] = ch; } break; case ST_COMM: if( ch == '\n' ) { t = x = i = 0;
public String getMimeType( String extension, String def ) throws IOException { int state, t, x, i, off; byte ch; byte[] type = new byte[128]; byte[] buf = new byte[16]; byte[] ext = extension.toLowerCase().getBytes( "ASCII" ); state = ST_START; t = x = i = 0; for( off = 0; off < inLen; off++ ) { ch = in[off]; switch( state ) { case ST_START: if( ch == ' ' || ch == '\t' ) { break; } else if( ch == '#' ) { state = ST_COMM; break; } state = ST_TYPE; case ST_TYPE: if( ch == ' ' || ch == '\t' ) { state = ST_GAP; } else { type[t++] = ch; } break; case ST_COMM: if( ch == '\n' ) { t = x = i = 0;
public String getMimeType( String extension, String def ) throws IOException { int state, t, x, i, off; byte ch; byte[] type = new byte[128]; byte[] buf = new byte[16]; byte[] ext = extension.toLowerCase().getBytes( "ASCII" ); state = ST_START; t = x = i = 0; for( off = 0; off < inLen; off++ ) { ch = in[off]; switch( state ) { case ST_START: if( ch == ' ' || ch == '\t' ) { break; } else if( ch == '#' ) { state = ST_COMM; break; } state = ST_TYPE; case ST_TYPE: if( ch == ' ' || ch == '\t' ) { state = ST_GAP; } else { type[t++] = ch; } break; case ST_COMM: if( ch == '\n' ) { t = x = i = 0;
public String getMimeType( String extension, String def ) throws IOException { int state, t, x, i, off; byte ch; byte[] type = new byte[128]; byte[] buf = new byte[16]; byte[] ext = extension.toLowerCase().getBytes( "ASCII" ); state = ST_START; t = x = i = 0; for( off = 0; off < inLen; off++ ) { ch = in[off]; switch( state ) { case ST_START: if( ch == ' ' || ch == '\t' ) { break; } else if( ch == '#' ) { state = ST_COMM; break; } state = ST_TYPE; case ST_TYPE: if( ch == ' ' || ch == '\t' ) { state = ST_GAP; } else { type[t++] = ch; } break; case ST_COMM: if( ch == '\n' ) { t = x = i = 0;
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 ); } } protected int compareNames( SmbFile f1, String f1name, SmbFile f2 ) throws IOException {
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 ); } } protected int compareNames( SmbFile f1, String f1name, SmbFile f2 ) throws IOException {
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 ); } } protected int compareNames( SmbFile f1, String f1name, SmbFile f2 ) throws IOException {
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 ); } } protected int compareNames( SmbFile f1, String f1name, SmbFile f2 ) throws IOException {