/** * Extracts the file name from the URL. * * @param url the url. * @return the extracted filename. */ public String getFileName( final URL url ) { final String fileRaw = url.getFile(); final int query = fileRaw.lastIndexOf( '?' ); final String file; if ( query == -1 ) { file = fileRaw; } else { file = fileRaw.substring( 0, query ); } // Now the processing is the same as if it is a string return getFileName( file ); }
/** * Extracts the file name from the URL. * * @param url the url. * @return the extracted filename. */ public String getFileName(final URL url) { final String fileRaw = url.getFile(); final int query = fileRaw.lastIndexOf('?'); final String file; if (query == -1) { file = fileRaw; } else { file = fileRaw.substring(0, query); } // Now the processing is the same as if it is a string return getFileName(file); }
public URLResourceData( final ResourceKey key ) { if ( key == null ) { throw new NullPointerException(); } this.modificationDate = -1; this.key = key; this.url = (URL) key.getIdentifier(); // for the ease of implementation, we take the file name from the URL. // Feel free to add a 'Content-Disposition' parser with all details :) this.filename = IOUtils.getInstance().getFileName( url ); }
public ZipReadContentItem( final ZipReadRepository repository, final ZipReadContentLocation parent, final ZipEntry zipEntry, final byte[] bytes ) { if ( repository == null ) { throw new NullPointerException(); } if ( zipEntry == null ) { throw new NullPointerException(); } if ( bytes == null ) { throw new NullPointerException(); } this.parent = parent; this.repository = repository; this.comment = zipEntry.getComment(); this.name = zipEntry.getName(); this.entryName = IOUtils.getInstance().getFileName( name ); this.size = zipEntry.getSize(); this.time = zipEntry.getTime(); this.rawData = bytes; }
public ZipReadContentLocation( ZipReadRepository repository, ZipReadContentLocation parent, ZipEntry zipEntry ) { if ( repository == null ) { throw new NullPointerException(); } if ( parent == null ) { throw new NullPointerException(); } if ( zipEntry == null ) { throw new NullPointerException(); } this.repository = repository; this.parent = parent; this.comment = zipEntry.getComment(); this.size = zipEntry.getSize(); this.time = zipEntry.getTime(); this.entries = new HashMap(); this.entryName = IOUtils.getInstance().getFileName( zipEntry.getName() ); this.name = RepositoryUtilities.buildName( this, "/" ) + '/'; }
public ZipContentLocation( ZipRepository repository, ZipContentLocation parent, ZipEntry zipEntry ) { if ( repository == null ) { throw new NullPointerException(); } if ( parent == null ) { throw new NullPointerException(); } if ( zipEntry == null ) { throw new NullPointerException(); } this.repository = repository; this.parent = parent; this.entryName = IOUtils.getInstance().getFileName( zipEntry.getName() ); this.comment = zipEntry.getComment(); this.size = zipEntry.getSize(); this.time = zipEntry.getTime(); this.entries = new HashMap(); this.name = RepositoryUtilities.buildName( this, "/" ) + '/'; }
this.comment = zipEntry.getComment(); this.name = RepositoryUtilities.buildName( this, "/" ); this.entryName = IOUtils.getInstance().getFileName( name ); this.size = zipEntry.getSize(); this.crc32 = zipEntry.getCrc();
private String extractFilename( final ResourceData resourceData ) { final String filename = (String) resourceData.getAttribute( ResourceData.FILENAME ); if ( filename == null ) { return "image"; } final String pureFileName = IOUtils.getInstance().getFileName( filename ); return IOUtils.getInstance().stripFileExtension( pureFileName ); }
final String fileNameWExt = IOUtils.getInstance().getFileName( path ); String fileExtension = IOUtils.getInstance().getFileExtension( fileNameWExt ); if ( StringUtils.isEmpty( fileExtension ) ) {
final URL maybeRealURL = resourceManager.toURL( url ); if ( maybeRealURL != null ) { final String originalFileName = IOUtils.getInstance().getFileName( maybeRealURL ); return new ImageData( imageData, mimeType, originalFileName ); } else { final URL maybeRealURL = resourceManager.toURL( url ); if ( maybeRealURL != null ) { originalFileName = IOUtils.getInstance().getFileName( maybeRealURL ); } else {