public static CopyState getCopyState ( final HttpURLConnection request ) throws URISyntaxException , ParseException { String copyStatusString = request . getHeaderField ( Constants . HeaderConstants . COPY_STATUS ) ; if ( ! Utility . isNullOrEmpty ( copyStatusString ) ) { final CopyState copyState = new CopyState ( ) ; copyState . setStatus ( CopyStatus . parse ( copyStatusString ) ) ; copyState . setCopyId ( request . getHeaderField ( Constants . HeaderConstants . COPY_ID ) ) ; copyState . setStatusDescription ( request . getHeaderField ( Constants . HeaderConstants . COPY_STATUS_DESCRIPTION ) ) ; final String copyProgressString = request . getHeaderField ( Constants . HeaderConstants . COPY_PROGRESS ) ; if ( ! Utility . isNullOrEmpty ( copyProgressString ) ) { String [ ] progressSequence = copyProgressString . split ( "/" ) ; copyState . setBytesCopied ( Long . parseLong ( progressSequence [ 0 ] ) ) ; copyState . setTotalBytes ( Long . parseLong ( progressSequence [ 1 ] ) ) ; } final String copySourceString = request . getHeaderField ( Constants . HeaderConstants . COPY_SOURCE ) ; if ( ! Utility . isNullOrEmpty ( copySourceString ) ) { copyState . setSource ( new URI ( copySourceString ) ) ; } final String copyCompletionTimeString = request . getHeaderField ( Constants . HeaderConstants . COPY_COMPLETION_TIME ) ; if ( ! Utility . isNullOrEmpty ( copyCompletionTimeString ) ) { copyState . setCompletionTime ( Utility . parseRFC1123DateFromStringInGMT ( copyCompletionTimeString ) ) ; } return copyState ; } else { return null ; } }
Gets the copyState