public static FileAttributes getFileAttributes(final HttpURLConnection request, final StorageUri resourceURI)
            throws URISyntaxException, ParseException {
    """
	Gets the CloudFileAttributes from the given request
	
	@param request
	The response from server.
	@param resourceURI
	The file uri to set.
	@return the CloudFileAttributes from the given request
	@throws ParseException
	@throws URISyntaxException
    """
        final FileAttributes fileAttributes = new FileAttributes();
        final FileProperties properties = fileAttributes.getProperties();

        properties.setCacheControl(request.getHeaderField(Constants.HeaderConstants.CACHE_CONTROL));
        properties.setContentDisposition(request.getHeaderField(Constants.HeaderConstants.CONTENT_DISPOSITION));
        properties.setContentEncoding(request.getHeaderField(Constants.HeaderConstants.CONTENT_ENCODING));
        properties.setContentLanguage(request.getHeaderField(Constants.HeaderConstants.CONTENT_LANGUAGE));

        // For range gets, only look at 'x-ms-content-md5' for overall MD5
        if (!Utility.isNullOrEmpty(request.getHeaderField(Constants.HeaderConstants.CONTENT_RANGE))) {
            properties.setContentMD5(request.getHeaderField(FileConstants.FILE_CONTENT_MD5_HEADER));
        }
        else {
            properties.setContentMD5(request.getHeaderField(Constants.HeaderConstants.CONTENT_MD5));
        }

        properties.setContentType(request.getHeaderField(Constants.HeaderConstants.CONTENT_TYPE));
        properties.setEtag(BaseResponse.getEtag(request));
        properties.setCopyState(FileResponse.getCopyState(request));
        properties.setServerEncrypted(
                Constants.TRUE.equals(request.getHeaderField(Constants.HeaderConstants.SERVER_ENCRYPTED)));

        final Calendar lastModifiedCalendar = Calendar.getInstance(Utility.LOCALE_US);
        lastModifiedCalendar.setTimeZone(Utility.UTC_ZONE);
        lastModifiedCalendar.setTime(new Date(request.getLastModified()));
        properties.setLastModified(lastModifiedCalendar.getTime());

        final String rangeHeader = request.getHeaderField(Constants.HeaderConstants.CONTENT_RANGE);
        final String xContentLengthHeader = request.getHeaderField(FileConstants.CONTENT_LENGTH_HEADER);

        if (!Utility.isNullOrEmpty(rangeHeader)) {
            properties.setLength(Long.parseLong(rangeHeader.split("/")[1]));
        }
        else if (!Utility.isNullOrEmpty(xContentLengthHeader)) {
            properties.setLength(Long.parseLong(xContentLengthHeader));
        }
        else {
            // using this instead of the request property since the request
            // property only returns an int.
            final String contentLength = request.getHeaderField(Constants.HeaderConstants.CONTENT_LENGTH);

            if (!Utility.isNullOrEmpty(contentLength)) {
                properties.setLength(Long.parseLong(contentLength));
            }
        }

        fileAttributes.setStorageUri(resourceURI);
        
        fileAttributes.setMetadata(BaseResponse.getMetadata(request));

        return fileAttributes;
    }
public static FileAttributes getFileAttributes(final HttpURLConnection request, final StorageUri resourceURI)
            throws URISyntaxException, ParseException {
        final FileAttributes fileAttributes = new FileAttributes();
        final FileProperties properties = fileAttributes.getProperties();

        properties.setCacheControl(request.getHeaderField(Constants.HeaderConstants.CACHE_CONTROL));
        properties.setContentDisposition(request.getHeaderField(Constants.HeaderConstants.CONTENT_DISPOSITION));
        properties.setContentEncoding(request.getHeaderField(Constants.HeaderConstants.CONTENT_ENCODING));
        properties.setContentLanguage(request.getHeaderField(Constants.HeaderConstants.CONTENT_LANGUAGE));

        // For range gets, only look at 'x-ms-content-md5' for overall MD5
        if (!Utility.isNullOrEmpty(request.getHeaderField(Constants.HeaderConstants.CONTENT_RANGE))) {
            properties.setContentMD5(request.getHeaderField(FileConstants.FILE_CONTENT_MD5_HEADER));
        }
        else {
            properties.setContentMD5(request.getHeaderField(Constants.HeaderConstants.CONTENT_MD5));
        }

        properties.setContentType(request.getHeaderField(Constants.HeaderConstants.CONTENT_TYPE));
        properties.setEtag(BaseResponse.getEtag(request));
        properties.setCopyState(FileResponse.getCopyState(request));
        properties.setServerEncrypted(
                Constants.TRUE.equals(request.getHeaderField(Constants.HeaderConstants.SERVER_ENCRYPTED)));

        final Calendar lastModifiedCalendar = Calendar.getInstance(Utility.LOCALE_US);
        lastModifiedCalendar.setTimeZone(Utility.UTC_ZONE);
        lastModifiedCalendar.setTime(new Date(request.getLastModified()));
        properties.setLastModified(lastModifiedCalendar.getTime());

        final String rangeHeader = request.getHeaderField(Constants.HeaderConstants.CONTENT_RANGE);
        final String xContentLengthHeader = request.getHeaderField(FileConstants.CONTENT_LENGTH_HEADER);

        if (!Utility.isNullOrEmpty(rangeHeader)) {
            properties.setLength(Long.parseLong(rangeHeader.split("/")[1]));
        }
        else if (!Utility.isNullOrEmpty(xContentLengthHeader)) {
            properties.setLength(Long.parseLong(xContentLengthHeader));
        }
        else {
            // using this instead of the request property since the request
            // property only returns an int.
            final String contentLength = request.getHeaderField(Constants.HeaderConstants.CONTENT_LENGTH);

            if (!Utility.isNullOrEmpty(contentLength)) {
                properties.setLength(Long.parseLong(contentLength));
            }
        }

        fileAttributes.setStorageUri(resourceURI);
        
        fileAttributes.setMetadata(BaseResponse.getMetadata(request));

        return fileAttributes;
    }
public static FileAttributes getFileAttributes ( final HttpURLConnection request , final StorageUri resourceURI ) throws URISyntaxException , ParseException { final FileAttributes fileAttributes = new FileAttributes ( ) ; final FileProperties properties = fileAttributes . getProperties ( ) ; properties . setCacheControl ( request . getHeaderField ( Constants . HeaderConstants . CACHE_CONTROL ) ) ; properties . setContentDisposition ( request . getHeaderField ( Constants . HeaderConstants . CONTENT_DISPOSITION ) ) ; properties . setContentEncoding ( request . getHeaderField ( Constants . HeaderConstants . CONTENT_ENCODING ) ) ; properties . setContentLanguage ( request . getHeaderField ( Constants . HeaderConstants . CONTENT_LANGUAGE ) ) ; // For range gets, only look at 'x-ms-content-md5' for overall MD5 if ( ! Utility . isNullOrEmpty ( request . getHeaderField ( Constants . HeaderConstants . CONTENT_RANGE ) ) ) { properties . setContentMD5 ( request . getHeaderField ( FileConstants . FILE_CONTENT_MD5_HEADER ) ) ; } else { properties . setContentMD5 ( request . getHeaderField ( Constants . HeaderConstants . CONTENT_MD5 ) ) ; } properties . setContentType ( request . getHeaderField ( Constants . HeaderConstants . CONTENT_TYPE ) ) ; properties . setEtag ( BaseResponse . getEtag ( request ) ) ; properties . setCopyState ( FileResponse . getCopyState ( request ) ) ; properties . setServerEncrypted ( Constants . TRUE . equals ( request . getHeaderField ( Constants . HeaderConstants . SERVER_ENCRYPTED ) ) ) ; final Calendar lastModifiedCalendar = Calendar . getInstance ( Utility . LOCALE_US ) ; lastModifiedCalendar . setTimeZone ( Utility . UTC_ZONE ) ; lastModifiedCalendar . setTime ( new Date ( request . getLastModified ( ) ) ) ; properties . setLastModified ( lastModifiedCalendar . getTime ( ) ) ; final String rangeHeader = request . getHeaderField ( Constants . HeaderConstants . CONTENT_RANGE ) ; final String xContentLengthHeader = request . getHeaderField ( FileConstants . CONTENT_LENGTH_HEADER ) ; if ( ! Utility . isNullOrEmpty ( rangeHeader ) ) { properties . setLength ( Long . parseLong ( rangeHeader . split ( "/" ) [ 1 ] ) ) ; } else if ( ! Utility . isNullOrEmpty ( xContentLengthHeader ) ) { properties . setLength ( Long . parseLong ( xContentLengthHeader ) ) ; } else { // using this instead of the request property since the request // property only returns an int. final String contentLength = request . getHeaderField ( Constants . HeaderConstants . CONTENT_LENGTH ) ; if ( ! Utility . isNullOrEmpty ( contentLength ) ) { properties . setLength ( Long . parseLong ( contentLength ) ) ; } } fileAttributes . setStorageUri ( resourceURI ) ; fileAttributes . setMetadata ( BaseResponse . getMetadata ( request ) ) ; return fileAttributes ; }
Gets the CloudFileAttributes from the given request

@param request
The response from server.
@param resourceURI
The file uri to set.
@return the CloudFileAttributes from the given request
@throws ParseException
@throws URISyntaxException
Gets the CloudFileAttributes from the given request