-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f0029d7
commit cf583c4
Showing
84 changed files
with
1,755 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Marvellous Infosystems Pune |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ABCDEFGHIJ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
AAAAAAAAAABBBBBBBBBB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
AAAAAAAAAABBBBBBBBBBCCCCCCCCCC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Hello.txt 10 ABCDEFGHIJIndia.txt 20 AAAAAAAAAABBBBBBBBBBLogic.txt 30 AAAAAAAAAABBBBBBBBBBCCCCCCCCCC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ABCDEFGHIJ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
AAAAAAAAAABBBBBBBBBB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
AAAAAAAAAABBBBBBBBBBCCCCCCCCCC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Hello.txt 10 ABCDEFGHIJIndia.txt 20 AAAAAAAAAABBBBBBBBBBLogic.txt 30 AAAAAAAAAABBBBBBBBBBCCCCCCCCCC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ABCDEFGHIJ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
AAAAAAAAAABBBBBBBBBB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
AAAAAAAAAABBBBBBBBBBCCCCCCCCCC |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import java.io.*; | ||
import java.util.*; | ||
import java.nio.charset.StandardCharsets; | ||
|
||
class MarvellousPacker | ||
{ | ||
public static void main(String a[]) | ||
{ | ||
Scanner sobj = new Scanner(System.in); | ||
System.out.println("--------- Marvellous Packer Unpacker CUI Panel --------- "); | ||
|
||
try | ||
{ | ||
System.out.println("Enter folder name which contains the files that you want to pack : "); | ||
String FolderName = sobj.nextLine(); | ||
|
||
File fobj = new File(FolderName); | ||
|
||
System.out.println("Enter the name of packed file that you want to create : "); | ||
System.out.println("Note : Packed file gets automatically created in the current directory."); | ||
|
||
String PackFile = sobj.nextLine(); | ||
|
||
File fpackobj = new File(PackFile); | ||
fpackobj.createNewFile(); | ||
|
||
FileOutputStream fout = new FileOutputStream(fpackobj); | ||
|
||
if(fobj.exists()) | ||
{ | ||
File allfiles[] = fobj.listFiles(); | ||
|
||
System.out.println("File names are : "); | ||
|
||
byte Buffer[] = new byte[1024]; | ||
int ret = 0,Counter = 0; | ||
|
||
String name; | ||
|
||
for(int i = 0; i< allfiles.length; i++) | ||
{ | ||
name = allfiles[i].getName(); | ||
|
||
if(name.endsWith(".txt")) | ||
{ | ||
name = name + " " + (allfiles[i].length()); | ||
System.out.println("File Name : "+allfiles[i].getName()+" with length : "+allfiles[i].length() +"bytes"); | ||
|
||
for(int j = name.length(); j < 100; j++) // Header formation | ||
{ | ||
name = name + " "; | ||
} | ||
|
||
byte HeaderByte [] = name.getBytes(); // String to byte array conversion | ||
|
||
fout.write(HeaderByte,0,HeaderByte.length); // write header in packed file | ||
|
||
FileInputStream fiobj = new FileInputStream(allfiles[i]); | ||
|
||
while((ret = fiobj.read(Buffer)) != -1) | ||
{ | ||
fout.write(Buffer,0,ret); | ||
} | ||
Counter++; | ||
} | ||
} | ||
|
||
System.out.println("----- Summary -----"); | ||
System.out.println("Number of files scanned : "+allfiles.length); | ||
System.out.println("Number of files packed succesfully : "+ Counter); | ||
|
||
System.out.println("Thank you for using Marvellous Packer Unpacker Application"); | ||
} | ||
else | ||
{ | ||
System.out.println("There is no such folder.."); | ||
} | ||
|
||
}// End of try | ||
catch(Exception obj) | ||
{ | ||
System.out.println("Exception occured : "+obj); | ||
} | ||
} //end of main | ||
} // end of class |
Binary file not shown.
63 changes: 63 additions & 0 deletions
63
PackerUnpacker/FinalPackerUnpacker/MarvellousUnpacker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import java.io.*; | ||
import java.util.*; | ||
import java.nio.charset.StandardCharsets; | ||
|
||
class MarvellousUnpacker | ||
{ | ||
public static void main(String a[]) | ||
{ | ||
Scanner sobj = new Scanner(System.in); | ||
System.out.println("--------- Marvellous Packer Unpacker CUI Panel --------- "); | ||
|
||
try | ||
{ | ||
System.out.println("Enter the name of packed file : "); | ||
System.out.println("Note : Packed file should be in the current directory."); | ||
|
||
String PackFile = sobj.nextLine(); | ||
File fpackobj = new File(PackFile); | ||
|
||
FileInputStream fin = new FileInputStream(fpackobj); | ||
int Ret = 0, Count = 0; | ||
byte Header[] = new byte[100]; | ||
|
||
if(fpackobj.exists()) | ||
{ | ||
while((Ret = fin.read(Header,0,100)) > 0) | ||
{ | ||
String StrHeader = new String(Header); | ||
|
||
String Arr[] = StrHeader.split(" "); | ||
|
||
File obj = new File(Arr[0]); | ||
obj.createNewFile(); | ||
System.out.println("New file dropped with name : "+Arr[0]); | ||
|
||
int FileSize = Integer.parseInt(Arr[1]); | ||
|
||
byte DataArray[] = new byte[FileSize]; | ||
|
||
fin.read(DataArray,0,FileSize); | ||
|
||
FileOutputStream fout = new FileOutputStream(obj); | ||
fout.write(DataArray,0,FileSize); | ||
|
||
Count++; | ||
} | ||
System.out.println("----- Summary -----"); | ||
System.out.println("Number of files unpacked succesfully : "+Count); | ||
|
||
System.out.println("Thank you for using Marvellous Packer Unpacker Application"); | ||
} | ||
else | ||
{ | ||
System.out.println("There is no such file.."); | ||
} | ||
|
||
}// End of try | ||
catch(Exception obj) | ||
{ | ||
System.out.println("Exception occured : "+obj); | ||
} | ||
} //end of main | ||
} // end of class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ABCDEFGHIJ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
AAAAAAAAAABBBBBBBBBB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ABCDEFGHIJaaaaabbbbbcccccdddddAaaaaaaaaabbbbbbbbbbcccccccccc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
AAAAAAAAAABBBBBBBBBBCCCCCCCCCC |
Binary file not shown.
Empty file.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Hello.txt 10 ABCDEFGHIJIndia.txt 20 AAAAAAAAAABBBBBBBBBBLogic.txt 30 AAAAAAAAAABBBBBBBBBBCCCCCCCCCC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
ABCDEFGHIJABCDEFGHIJAAAAAAAAAA | ||
BBBBBBBBBBAAAAAAAAAA | ||
BBBBBBBBBB | ||
CCCCCCCCCC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ABCDEFGHIJABCDEFGHIJAAAAAAAAAABBBBBBBBBBAAAAAAAAAABBBBBBBBBBCCCCCCCCCC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ABCDEFGHIJ |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import java.util.*; | ||
import java.io.*; | ||
|
||
class Program401 | ||
{ | ||
public static void main(String Ar[]) | ||
{ | ||
Scanner sobj = new Scanner(System.in); | ||
|
||
System.out.println("Enter file name : "); | ||
String FileName = sobj.nextLine(); | ||
|
||
System.out.println("File name is : "+FileName); | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import java.util.*; | ||
import java.io.*; | ||
|
||
class Program402 | ||
{ | ||
public static void main(String Ar[]) throws Exception | ||
{ | ||
Scanner sobj = new Scanner(System.in); | ||
|
||
System.out.println("Enter file name : "); | ||
String FileName = sobj.nextLine(); | ||
|
||
File fobj = new File(FileName); | ||
|
||
fobj.createNewFile(); | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import java.util.*; | ||
import java.io.*; | ||
|
||
class Program403 | ||
{ | ||
public static void main(String Ar[]) throws Exception | ||
{ | ||
Scanner sobj = new Scanner(System.in); | ||
|
||
System.out.println("Enter file name : "); | ||
String FileName = sobj.nextLine(); | ||
|
||
File fobj = new File(FileName); | ||
|
||
boolean bobj = fobj.createNewFile(); | ||
if(bobj == true) | ||
{ | ||
System.out.println("File is successfully created"); | ||
} | ||
else | ||
{ | ||
System.out.println("Unable to create file"); | ||
} | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import java.util.*; | ||
import java.io.*; | ||
|
||
class Program404 | ||
{ | ||
public static void main(String Ar[]) throws Exception | ||
{ | ||
Scanner sobj = new Scanner(System.in); | ||
|
||
System.out.println("Enter file name : "); | ||
String FileName = sobj.nextLine(); | ||
|
||
File fobj = new File(FileName); | ||
|
||
if (fobj.exists()) | ||
{ | ||
System.out.println("File size is : "+fobj.length()); | ||
} | ||
else | ||
{ | ||
System.out.println("There is no such file"); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import java.util.*; | ||
import java.io.*; | ||
|
||
class Program405 | ||
{ | ||
public static void main(String Ar[]) throws Exception | ||
{ | ||
Scanner sobj = new Scanner(System.in); | ||
|
||
System.out.println("Enter file name : "); | ||
String FileName = sobj.nextLine(); | ||
|
||
File fobj = new File(FileName); | ||
|
||
if (fobj.exists()) | ||
{ | ||
BufferedReader bobj = new BufferedReader(new FileReader(fobj)); | ||
|
||
String data; | ||
|
||
while((data = bobj.readLine()) != null) | ||
{ | ||
System.out.println(data); | ||
} | ||
} | ||
else | ||
{ | ||
System.out.println("There is no such file"); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import java.util.*; | ||
import java.io.*; | ||
import java.nio.charset.StandardCharsets; | ||
|
||
class Program406 | ||
{ | ||
public static void main(String Ar[]) throws Exception | ||
{ | ||
Scanner sobj = new Scanner(System.in); | ||
|
||
System.out.println("Enter file name : "); | ||
String FileName = sobj.nextLine(); | ||
|
||
File fobj = new File(FileName); | ||
|
||
if(fobj.exists()) | ||
{ | ||
FileInputStream fiobj = new FileInputStream(fobj); | ||
|
||
byte Buffer[] = new byte[100]; | ||
int ret = 0; | ||
|
||
while((ret = fiobj.read(Buffer)) != -1) | ||
{ | ||
String str = new String(Buffer,StandardCharsets.UTF_8); | ||
System.out.println(str); | ||
} | ||
} | ||
else | ||
{ | ||
System.out.println("There is no such file"); | ||
} | ||
|
||
} | ||
} |
Binary file not shown.
Oops, something went wrong.