Produced by Araxis Merge on 2/7/2017 12:14:08 PM Eastern 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 | cpss.zip\cpss\src\main\java\gov\va\cpss\service | SftpStreamSession.java | Wed Feb 1 21:07:26 2017 UTC |
2 | cpss.zip\cpss\src\main\java\gov\va\cpss\service | SftpStreamSession.java | Mon Feb 6 15:19:30 2017 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 144 |
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 | package go v.va.cpss. service; | |
2 | ||
3 | import jav a.io.IOExc eption; | |
4 | import jav a.io.Input Stream; | |
5 | ||
6 | import org .apache.lo g4j.Logger ; | |
7 | ||
8 | /** | |
9 | * Encapsu lates an a ctive Sftp Session an d InputStr eam for re ading cont ents of a | |
10 | * remote file. Afte r reading the conten ts from th e InputStr eam, a cli ent should | |
11 | * call cl ose() to c lose the I nputStream and Sessi on. | |
12 | * | |
13 | * @author DN S D N S | |
14 | * | |
15 | */ | |
16 | public cla ss SftpStr eamSession { | |
17 | ||
18 | pr ivate stat ic final L ogger logg er = Logge r.getLogge r(SftpStre amSession. class.getC anonicalNa me()); | |
19 | ||
20 | pr ivate Sftp Session se ssion; | |
21 | ||
22 | pr ivate Inpu tStream in putStream; | |
23 | ||
24 | /* * | |
25 | * Create an SftpStrea mSession w ith the gi ven SftpSe ssion and InputStrea m | |
26 | * represent ing an ope n session to an Sftp Server fo r reading the conten ts | |
27 | * of a remo te file. | |
28 | * | |
29 | * @param se ssion | |
30 | * SftpSess ion repres enting an open sessi on to the Sftp Serve r | |
31 | * for read ing the co ntents of a remote f ile. | |
32 | * @param in putStream | |
33 | * An open InputStrea m used for reading t he content s of the | |
34 | * remote f ile. | |
35 | * / | |
36 | pu blic SftpS treamSessi on(SftpSes sion sessi on, InputS tream inpu tStream) { | |
37 | this .session = session; | |
38 | this .inputStre am = input Stream; | |
39 | } | |
40 | ||
41 | /* * | |
42 | * Get the I nputStream for readi ng the con tents of t he remote file. | |
43 | * | |
44 | * @return I nputStream for readi ng the con tents of t he remote file. | |
45 | * / | |
46 | pu blic Input Stream get InputStrea m() { | |
47 | retu rn inputSt ream; | |
48 | } | |
49 | ||
50 | /* * | |
51 | * Closes th e InputStr eam and Sf tpSession. Should be called by the clien t | |
52 | * after the file cont ents have been read from the I nputStream . | |
53 | * / | |
54 | pu blic void close() { | |
55 | if ( inputStrea m != null) { | |
56 | try { | |
57 | inputStr eam.close( ); | |
58 | inputStr eam = null ; | |
59 | } catc h (IOExcep tion e) { | |
60 | logger.e rror("Unex pected exc eption whe n closing input stre am: " + e. getMessage ()); | |
61 | } | |
62 | } | |
63 | if ( session != null) { | |
64 | try { | |
65 | session. close(); | |
66 | session = null; | |
67 | } catc h (IOExcep tion e) { | |
68 | logger.e rror("Unex pected exc eption whe n closing sFTP sessi on: " + e. getMessage ()); | |
69 | } | |
70 | } | |
71 | } | |
72 | ||
73 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.