<p>Retrieve file name from part.</p>
@param pPart file data
@return file name
@throws Exception - an exception
775197
public final String getSubmittedFileName(
    final Part pPart) throws Exception {
    for (String cd : pPart.getHeader("content-disposition").split(";")) {
      if (cd.trim().startsWith("filename")) {
        String fileName = cd.substring(cd.indexOf('=') + 1)
          .trim().replace("\"", "");
        return fileName.substring(fileName.lastIndexOf('/') + 1)
          .substring(fileName.lastIndexOf('\\') + 1); // MSIE fix.
      }
    }
    throw new ExceptionWithCode(ExceptionWithCode.SOMETHING_WRONG,
      "Can't retrieve file name");
  }
309248
private void readTrueColor(ImageReadParam pParam, final ImageInputStream pInput) throws IOException {
        final int width = header.width;
        final int height = header.height;

        final Rectangle aoi = getSourceRegion(pParam, width, height);
        final Point offset = pParam == null ? new Point(0, 0) : pParam.getDestinationOffset();

        // Set everything to default values
        int sourceXSubsampling = 1;
        int sourceYSubsampling = 1;
        int[] sourceBands = null;
        int[] destinationBands = null;

        // Get values from the ImageReadParam, if any
        if (pParam != null) {
            sourceXSubsampling = pParam.getSourceXSubsampling();
            sourceYSubsampling = pParam.getSourceYSubsampling();

            sourceBands = pParam.getSourceBands();
            destinationBands = pParam.getDestinationBands();
        }

        // Ensure band settings from param are compatible with images
        checkReadParamBandSettings(pParam, header.bitplanes / 8, image.getSampleModel().getNumBands());

        // NOTE:  Each row of the image is stored in an integral number of 16 bit words.
        // The number of words per row is words=((w+15)/16)
        int planeWidth = 2 * ((width + 15) / 16);
        final byte[] planeData = new byte[8 * planeWidth];

        WritableRaster destination = image.getRaster();
        if (destinationBands != null || offset.x != 0 || offset.y != 0) {
            destination = destination.createWritableChild(0, 0, destination.getWidth(), destination.getHeight(), offset.x, offset.y, destinationBands);
        }
//        WritableRaster raster = image.getRaster().createCompatibleWritableRaster(width, 1);
        WritableRaster raster = image.getRaster().createCompatibleWritableRaster(8 * planeWidth, 1);
        Raster sourceRow = raster.createChild(aoi.x, 0, aoi.width, 1, 0, 0, sourceBands);

        final byte[] data = ((DataBufferByte) raster.getDataBuffer()).getData();
        final int channels = (header.bitplanes + 7) / 8;
        final int planesPerChannel = 8;
        Object dataElements = null;

        for (int srcY = 0; srcY < height; srcY++) {
            for (int c = 0; c < channels; c++) {
                for (int p = 0; p < planesPerChannel; p++) {
                    readPlaneData(pInput, planeData, p * planeWidth, planeWidth);
                }

                // Skip rows outside AOI
                if (srcY >= (aoi.y + aoi.height)) {
                    return;
                }
                else if (srcY < aoi.y || (srcY - aoi.y) % sourceYSubsampling != 0) {
                    continue;
                }

                if (formType == IFF.TYPE_ILBM) {
                    // NOTE: Using (channels - c - 1) instead of just c,
                    // effectively reverses the channel order from RGBA to ABGR
                    int off = (channels - c - 1);

                    int pixelPos = 0;
                    for (int planePos = 0; planePos < planeWidth; planePos++) {
                        IFFUtil.bitRotateCW(planeData, planePos, planeWidth, data, off + pixelPos * channels, channels);
                        pixelPos += 8;
                    }
                }
                else if (formType == IFF.TYPE_PBM) {
                    System.arraycopy(planeData, 0, data, srcY * 8 * planeWidth, planeWidth);
                }
                else {
                    throw new AssertionError(String.format("Unsupported FORM type: %s", formType));
                }
            }

            if (srcY >= aoi.y && (srcY - aoi.y) % sourceYSubsampling == 0) {
                int dstY = (srcY - aoi.y) / sourceYSubsampling;
                // TODO: Support conversion to INT (A)RGB rasters (maybe using ColorConvertOp?)
                // TODO: Avoid createChild if no region?
                if (sourceXSubsampling == 1) {
                    destination.setRect(0, dstY, sourceRow);
//                dataElements = raster.getDataElements(aoi.x, 0, aoi.width, 1, dataElements);
//                destination.setDataElements(offset.x, offset.y + (srcY - aoi.y) / sourceYSubsampling, aoi.width, 1, dataElements);
                }
                else {
                    for (int srcX = 0; srcX < sourceRow.getWidth(); srcX += sourceXSubsampling) {
                        dataElements = sourceRow.getDataElements(srcX, 0, dataElements);
                        int dstX = srcX / sourceXSubsampling;
                        destination.setDataElements(dstX, dstY, dataElements);
                    }
                }
            }

            processImageProgress(srcY * 100f / header.width);
            if (abortRequested()) {
                processReadAborted();
                break;
            }
        }
    }
1264054
func (document *Document) GetPartName(part int) string {
	cPart := C.int(part)
	cPartName := C.get_document_part_name(document.handle, cPart)
	defer C.free(unsafe.Pointer(cPartName))
	return C.GoString(cPartName)
}
167378
public static String getFilenameFromHeader(String url, String contentDisposition) {
    String filename;
    if (!TextUtils.isEmpty(contentDisposition)) {
      int index = contentDisposition.indexOf("filename");
      if (index > 0) {
        filename = contentDisposition.substring(index + 9, contentDisposition.length());
        return filename;
      } else {
        filename = getFilenameFromUrl(url);
      }
    } else {
      filename = getFilenameFromUrl(url);
    }

    try {
      filename = URLDecoder.decode(filename, "UTF-8");
    } catch (UnsupportedEncodingException e) {
      /* ignore */
    }

    return filename;
  }
22243
private int getFileType(String filename) throws Exception {

        String extension = "";
        if (filename.indexOf(".") > -1) {
            extension = filename.substring((filename.lastIndexOf(".")));
        }

        String typename = (String)m_extensions.get(extension.toLowerCase());
        if (typename == null) {
            typename = "binary";
        }
        CmsResourceManager resourceManager = OpenCms.getResourceManager();

        return resourceManager.getResourceType(typename).getTypeId();
    }
1010755
def next_image_partname(self, ext):
        
        def first_available_image_idx():
            image_idxs = sorted([
                part.partname.idx for part in self.iter_parts()
                if part.partname.startswith('/ppt/media/image')
                and part.partname.idx is not None
            ])
            for i, image_idx in enumerate(image_idxs):
                idx = i + 1
                if idx < image_idx:
                    return idx
            return len(image_idxs)+1

        idx = first_available_image_idx()
        return PackURI('/ppt/media/image%d.%s' % (idx, ext))
976345
@Override
    public String getFilename() {
        try {
            if (hasDescriptionProperty(FILENAME)) {
                return getDescriptionProperty(FILENAME).getString().replace(FIELD_DELIMITER + XSDstring.getURI(), "");
            }
            return node.getName();
        } catch (final RepositoryException e) {
            throw new RepositoryRuntimeException(e);
        }
    }
501228
protected String toFilename(final Resource resource) throws UnsupportedOperationException {
        if (resource instanceof FileResource) {
            return ((FileResource) resource).getFile().getPath();
        }

        throw new UnsupportedOperationException("Unsupported resource type: " + resource);
    }
603472
private String setCurrentFilename(String relativePathOrPackage, String filename, String domain) throws Exception {
        currentFullFilename = convertToFullFilename(relativePathOrPackage, filename, domain);
        return "";
    }
504500
public static String getFileName(String filePath) {
		if (filePath == null) {
			return filePath;
		}
		int index = filePath.lastIndexOf(File.separator);
		if (index == -1) {
			return filePath;
		}
		return filePath.substring(index + 1);
	}
374453
protected static String getFileName(Appender app) {

        String result = null;
        Method getFileName;
        try {
            getFileName = app.getClass().getDeclaredMethod("getFileName", (Class<?>[])null);

            result = (String)getFileName.invoke(app, (Object[])null);
        } catch (Exception e) {
            LOG.warn(e.getLocalizedMessage(), e);
        }
        return result;
    }
319823
private static String getFileName(Resource file) {
	String name = file.getName();
	int pos = name.lastIndexOf(".");

	if (pos == -1) return name;
	return name.substring(0, pos);
    }
284787
public final String evalFileNameWithoutExtension(final String pPath) {
    int idxStart = 0;
    int idxEnd = pPath.length();
    int lastFs = pPath.lastIndexOf('/');
    if (lastFs == -1) {
      lastFs = pPath.lastIndexOf('\\');
    }
    if (lastFs != -1) {
      idxStart = lastFs + 1;
    }
    int idxDot = pPath.lastIndexOf('.');
    if (idxDot != -1) {
      idxEnd = idxDot;
    }
    return pPath.substring(idxStart, idxEnd);
  }
609122
@Override
  public final Method retrieveMethod(final Class<?> pClazz,
    final String pMethodName) throws Exception {
    for (Method mfd : pClazz.getDeclaredMethods()) {
      if (mfd.getName().equals(pMethodName)) {
        return mfd;
      }
    }
    final Class<?> superClazz = pClazz.getSuperclass();
    Method method = null;
    if (superClazz != null && superClazz != java.lang.Object.class) {
      method = retrieveMethod(superClazz, pMethodName);
    }
    if (method == null) {
      throw new Exception("There is no method " + pMethodName + " in class "
        + pClazz); //TO-DO class must be original
    }
    return method;
  }
44153
public String fileName()
    {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "fileName", this);
        if (tc.isEntryEnabled())
            Tr.exit(tc, "fileName", _fileName);
        return _fileName;
    }
534228
@Override
	public String name() {

		if (file == null) {
			return null;
		}

		String name = null;

		try (Tx tx = StructrApp.getInstance(securityContext).tx()) {

			name = file.getName();
			tx.success();

		} catch (FrameworkException fex) {
			logger.error("", fex);
		}

		return name;
	}
788462
@Override
    protected FileInfo getFileInfoFromInputDataImpl(HTTPRequest inputData)
    {
        //get content
        Map<String,ContentPart<?>> contentPartsMap=this.getContentPartsAsMap(inputData);

        //get file info
        FileInfo fileInfo=null;
        ContentPart<?> contentPart=contentPartsMap.get(this.fileContentParameter);
        if(contentPart==null)
        {
            throw new FaxException("File info not provided.");
        }
        ContentPartType contentPartType=contentPart.getType();
        switch(contentPartType)
        {
            case FILE:
                File file=(File)contentPart.getContent();
                fileInfo=new FileInfo(file);
                break;
            case BINARY:
                byte[] data=(byte[])contentPart.getContent();

                //get file name
                String fileName=this.getContentPartAsString(contentPartsMap,this.fileNameParameter);

                fileInfo=new FileInfo(fileName,data);
                break;
            default:
                throw new FaxException("Unsupported content part type: "+contentPartType);
        }

        return fileInfo;
    }