/**
* Get file status without file stream.
*
* @param fileId File id.
* @return File status.
* @throws IOException Http connection is fail or server response within some error message.
*/
public FileHandleStatus getFileStatus(String fileId) throws IOException {
final String targetUrl = getTargetUrl(fileId);
HeaderResponse headerResponse = volumeWrapper.getFileStatusHeader(targetUrl, fileId);
try {
return new FileHandleStatus(fileId,
headerDateFormat.parse(headerResponse.getLastHeader("Last-Modified").getValue()).getTime(),
headerResponse.getLastHeader("Content-Disposition").getValue()
.substring(10, headerResponse.getLastHeader("Content-Disposition").getValue().length() - 1),
headerResponse.getLastHeader("Content-Type").getValue(),
Long.parseLong(headerResponse.getLastHeader("Content-Length").getValue()));
} catch (ParseException e) {
throw new SeaweedfsException("Could not parse last modified time [" +
headerResponse.getLastHeader("Last-Modified").getValue() + "] to long value");
}
}
headerResponse.getLastHeader("Content-Type").getValue()Raisesjava.lang.NullPointerExceptionwhen the MIME type is empty in file.