Produced by Araxis Merge on 12/5/2017 12:06:43 PM Central Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ImagingCommon\main\src\java\gov\va\med\imaging | TextFileUtil.java | Mon Dec 4 21:34:26 2017 UTC |
| 2 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ImagingCommon\main\src\java\gov\va\med\imaging | TextFileUtil.java | Mon Dec 4 22:01:58 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 312 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | /** | |
| 2 | * | |
| 3 | Package: MAG - Vis tA Imaging | |
| 4 | WARNING: Per VHA D irective 2 004-038, t his routin e should n ot be modi fied. | |
| 5 | Date Cre ated: Marc h 4, 2005 | |
| 6 | Site Nam e: Washin gton OI Fi eld Office , Silver S pring, MD | |
| 7 | Developer:
|
|
| 8 | Descript ion: | |
| 9 | ||
| 10 | ;; +-------- ---------- ---------- ---------- ---------- ---------- ---------- + | |
| 11 | ;; Property of the US Government . | |
| 12 | ;; No permis sion to co py or redi stribute t his softwa re is give n. | |
| 13 | ;; Use of un released v ersions of this soft ware requi res the us er | |
| 14 | ;; to execu te a writt en test ag reement wi th the Vis tA Imaging | |
| 15 | ;; Developm ent Office of the De partment o f Veterans Affairs, | |
| 16 | ;; telephon e (301) 73 4-0100. | |
| 17 | ;; | |
| 18 | ;; The Food and Drug A dministrat ion classi fies this software a s | |
| 19 | ;; a Class I I medical device. A s such, it may not b e changed | |
| 20 | ;; in any wa y. Modifi cations to this soft ware may r esult in a n | |
| 21 | ;; adulterat ed medical device un der 21CFR8 20, the us e of which | |
| 22 | ;; is consid ered to be a violati on of US F ederal Sta tutes. | |
| 23 | ;; +-------- ---------- ---------- ---------- ---------- ---------- ---------- + | |
| 24 | */ | |
| 25 | package go v.va.med.i maging; | |
| 26 | ||
| 27 | import gov .va.med.im aging.exce ptions.Rea dFileExcep tion; | |
| 28 | import gov .va.med.im aging.exce ptions.Tex tFileExcep tion; | |
| 29 | import gov .va.med.im aging.exce ptions.Tex tFileExtra ctionExcep tion; | |
| 30 | ||
| 31 | import jav a.io.Buffe redReader; | |
| 32 | import jav a.io.File; | |
| 33 | import jav a.io.FileN otFoundExc eption; | |
| 34 | import jav a.io.FileR eader; | |
| 35 | import jav a.io.IOExc eption; | |
| 36 | ||
| 37 | import org .apache.lo gging.log4 j.LogManag er; | |
| 38 | import org .apache.lo gging.log4 j.Logger; | |
| 39 | ||
| 40 | /** | |
| 41 | * | |
| 42 | * @author William P eterson | |
| 43 | * | |
| 44 | */ | |
| 45 | public cla ss TextFil eUtil { | |
| 46 | ||
| 47 | privat e static f inal Logge r logger = LogManage r.getLogge r (TextFil eUtil.clas s); | |
| 48 | ||
| 49 | privat e Buffered Reader buf fer; | |
| 50 | privat e final in t MAX_SIZE = 5000; | |
| 51 | ||
| 52 | /** | |
| 53 | * Con structor | |
| 54 | * | |
| 55 | * | |
| 56 | */ | |
| 57 | public TextFileU til() { | |
| 58 | su per(); | |
| 59 | // TODO Auto -generated construct or stub | |
| 60 | } | |
| 61 | ||
| 62 | public void open TextFile(S tring text Filename)t hrows Text FileExcept ion{ | |
| 63 | ||
| 64 | tr y{ | |
| 65 | //Get Te xt file. | |
| 66 | //JUNIT Create tes t to verif y how this fails if not correc t permissi ons. | |
| 67 | this.buf fer = new BufferedRe ader(new F ileReader( textFilena me)); | |
| 68 | } | |
| 69 | ca tch(FileNo tFoundExce ption noFi le){ | |
| 70 | logger.e rror("Erro r: "+noFil e.getMessa ge()); | |
| 71 | logger.e rror(this. getClass() .getName() +": Dicom Toolkit la yer: " + | |
| 72 | "Exception thrown wh ile attemp ting to op en "+textF ilename+". "); | |
| 73 | throw ne w TextFile Exception( "Could not find or o pen "+text Filename+" .", noFile ); | |
| 74 | } | |
| 75 | } | |
| 76 | ||
| 77 | public void open TextFile(F ile file) throws Tex tFileExcep tion{ | |
| 78 | tr y{ | |
| 79 | //Get Te xt file. | |
| 80 | //JUNIT Create tes t to verif y how this fails if not correc t permissi ons. | |
| 81 | ||
| 82 | this.buf fer = new BufferedRe ader(new F ileReader( file)); | |
| 83 | } | |
| 84 | ca tch(FileNo tFoundExce ption noFi le){ | |
| 85 | logger.e rror("Erro r: "+noFil e.getMessa ge()); | |
| 86 | logger.e rror(this. getClass() .getName() +": Dicom Toolkit la yer: " + | |
| 87 | "Exception thrown wh ile attemp ting to op en "+file. getPath()+ "."); | |
| 88 | throw ne w TextFile Exception( "Could not find or o pen "+file .getPath() +".", noFi le); | |
| 89 | } | |
| 90 | ||
| 91 | } | |
| 92 | ||
| 93 | public String ge tNextTextL ine() thro ws TextFil eExtractio nException { | |
| 94 | St ring line; | |
| 95 | tr y{ | |
| 96 | boolean eof = fals e; | |
| 97 | do{ | |
| 98 | if(( line = thi s.buffer.r eadLine()) == null){ | |
| 99 | eof = true ; | |
| 100 | break; | |
| 101 | //return n ull; | |
| 102 | //notEOF = false; | |
| 103 | //line = " "; | |
| 104 | } | |
| 105 | else { | |
| 106 | if(line.le ngth() > 1 ){ | |
| 107 | line.t rim(); | |
| 108 | char f irstChar; | |
| 109 | firstC har = line .charAt(0) ; | |
| 110 | if(fir stChar == '#'){ | |
| 111 | li ne = ""; | |
| 112 | } | |
| 113 | } | |
| 114 | else{ | |
| 115 | line = ""; | |
| 116 | } | |
| 117 | } | |
| 118 | }while(l ine.equals ("")); | |
| 119 | ||
| 120 | if (eof) { | |
| 121 | buff er.close() ; | |
| 122 | retu rn null; | |
| 123 | } | |
| 124 | } | |
| 125 | ca tch(IOExce ption io){ | |
| 126 | logger.e rror("Erro r: "+io.ge tMessage() ); | |
| 127 | logger.e rror(this. getClass() .getName() +": " + | |
| 128 | "Exception thrown wh ile gettin g next lin e from Tex t Line."); | |
| 129 | throw ne w TextFile Extraction Exception( "Failure t o get next line.", i o); | |
| 130 | } | |
| 131 | ca tch(NullPo interExcep tion noptr ){ | |
| 132 | logger.e rror("Erro r: "+noptr .getMessag e()); | |
| 133 | logger.e rror(this. getClass() .getName() +": "+ | |
| 134 | "Exception thrown wh ile gettin g next lin e from Tex t Line."); | |
| 135 | throw ne w TextFile Extraction Exception( "Failure t o get next line.", n optr); | |
| 136 | } | |
| 137 | ca tch(String IndexOutOf BoundsExce ption noIn dex){ | |
| 138 | logger.e rror("Erro r: "+noInd ex.getMess age()); | |
| 139 | logger.e rror(this. getClass() .getName() +": "+ | |
| 140 | "Exception thrown wh ile gettin g next lin e from Tex t Line."); | |
| 141 | throw ne w TextFile Extraction Exception( "Failure t o get next line.", n oIndex); | |
| 142 | } | |
| 143 | re turn line; | |
| 144 | } | |
| 145 | ||
| 146 | ||
| 147 | public char[] ge tAllText() throws Rea dFileExcep tion{ | |
| 148 | ch ar[] text = new char [MAX_SIZE] ; | |
| 149 | tr y{ | |
| 150 | this.buf fer.read(t ext); | |
| 151 | } | |
| 152 | ca tch(IOExce ption ioX) { | |
| 153 | throw ne w ReadFile Exception( ); | |
| 154 | } | |
| 155 | re turn text; | |
| 156 | } | |
| 157 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.