public long getSize ( String filename ) throws IOException , ServerException { if ( filename == null ) { throw new IllegalArgumentException ( "Required argument missing" ) ; } Command cmd = new Command ( "SIZE" , filename ) ; Reply reply = null ; try { reply = controlChannel . execute ( cmd ) ; return Long . parseLong ( reply . getMessage ( ) ) ; } catch ( NumberFormatException e ) { throw ServerException . embedFTPReplyParseException ( new FTPReplyParseException ( FTPReplyParseException . MESSAGE_UNPARSABLE , "Could not parse size: " + reply . getMessage ( ) ) ) ; } catch ( UnexpectedReplyCodeException urce ) { throw ServerException . embedUnexpectedReplyCodeException ( urce ) ; } catch ( FTPReplyParseException rpe ) { throw ServerException . embedFTPReplyParseException ( rpe ) ; } }
Returns the remote file size .