import
java.io.*;
import
java.math.BigInteger;
import
java.security.MessageDigest;
import
java.security.NoSuchAlgorithmException;
class
MD5 {
public
static
String getMd5(String input)
{
try
{
MessageDigest md
= MessageDigest.getInstance(
"MD5"
);
byte
[] messageDigest
= md.digest(input.getBytes());
BigInteger no
=
new
BigInteger(
1
, messageDigest);
String hashtext = no.toString(
16
);
while
(hashtext.length() <
32
) {
hashtext =
"0"
+ hashtext;
}
return
hashtext;
}
catch
(
NoSuchAlgorithmException
e) {
throw
new
RuntimeException(e);
}
}
}
class
CV_SIOManager {
public
CV_SIOManager() {}
public
CVFile CVGetFile(
final
String
filePathName)
{
return
null
;
}
public
void
CVDisplayStats()
{
}
public
int
CVDeleteFile(
final
String filePathName)
{
return
0
;
}
public
int
CVMoveFile(
final
String sourcePathName,
final
String targetPathName)
{
return
0
;
}
public
int
CVCopyFile(
final
String sourcePathName,
final
String targetPathName)
{
return
0
;
}
}
class
CVFile {
private
String fileName;
public
CVFile()
{
}
public
CVFile(
final
String filePathName,
final
String
content)
{
fileName = filePathName;
}
public
void
CVModifyFile(
final
String
content)
{
}
public
int
CVReadFile(
int
revision,
String
content)
{
return
0
;
}
public
int
CVTrim()
{
return
0
;
}
}
public
class
SIOManagerDriver {
public
static
void
main(String[] args)
{
CV_SIOManager sm =
new
CV_SIOManager();
String contentInFile =
""
;
CVFile fx;
CVFile f1 =
new
CVFile(
"C:\\File1.txt"
,
"Welcome to Commvault 1!"
);
CVFile f2 =
new
CVFile(
"C:\\File2.txt"
,
"All The Best 2!"
);
CVFile f2_1 =
new
CVFile(
"C:\\File2_1.txt"
,
"All The Best 2!"
);
CVFile f9
=
new
CVFile(
"C:\\File9.txt"
,
"This is File 9"
);
sm.CVDisplayStats();
CVFile f4
=
new
CVFile(
"C:\\File4.txt"
,
"Good Luck 4!"
);
CVFile f4_1
=
new
CVFile(
"C:\\File4_1.txt"
,
"Good Luck 4!"
);
sm.CVDisplayStats();
CVFile f10
=
new
CVFile(
"D:\\File10.txt"
,
"Good Luck 10!"
);
CVFile f20 =
new
CVFile(
"D:\\File20.txt"
,
"Welcome to Commvault 20!"
);
CVFile f50 =
new
CVFile(
"D:\\File50.txt"
,
"Best Place to Work 50!"
);
CVFile f20_1 =
new
CVFile(
"D:\\File20_1.txt"
,
"Welcome to Commvault 20!"
);
sm.CVDisplayStats();
CVFile f60 =
new
CVFile(
"D:\\File60.txt"
,
"All THE Best 60!"
);
CVFile f70 =
new
CVFile(
"D:\\File70.txt"
,
"All The Best 70!"
);
CVFile f70_1
=
new
CVFile(
"D:\\File70.txt"
,
"Commvault 70!"
);
sm.CVDisplayStats();
fx = sm.CVGetFile(
"D:\\File60.txt"
);
if
(
null
!= fx) {
fx.CVReadFile(-
5
, contentInFile);
System.out.println(contentInFile);
}
f4.CVModifyFile(
"Welcome to Commvault 4!"
);
fx = sm.CVGetFile(
"C:\\File4.txt"
);
if
(
null
!= fx) {
fx.CVReadFile(
0
, contentInFile);
System.out.println(contentInFile);
}
fx = sm.CVGetFile(
"C:\\File4.txt"
);
if
(
null
!= fx) {
fx.CVReadFile(-
1
, contentInFile);
System.out.println(contentInFile);
}
sm.CVDisplayStats();
sm.CVMoveFile(
"C:\\File9.txt"
,
"D:\\File30.txt"
);
sm.CVMoveFile(
"C:\\File4.txt"
,
"D:\\File2.txt"
);
sm.CVDisplayStats();
sm.CVCopyFile(
"C:\\File4.txt"
,
"D:\\File21.txt"
);
sm.CVCopyFile(
"C:\\File3.txt"
,
"C:\\File40.txt"
);
sm.CVDisplayStats();
sm.CVDeleteFile(
"D:\\File20.txt"
);
sm.CVDisplayStats();
sm.CVDeleteFile(
"C:\\File1.txt"
);
sm.CVDeleteFile(
"C:\\File4.txt"
);
sm.CVDisplayStats();
sm.CVDeleteFile(
"D:\\File7.txt"
);
sm.CVDeleteFile(
"D:\\File70.txt"
);
sm.CVDeleteFile(
"D:\\File30.txt"
);
sm.CVDisplayStats();