Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
vaibhavpatilX authored Jun 22, 2024
1 parent f0029d7 commit cf583c4
Show file tree
Hide file tree
Showing 84 changed files with 1,755 additions and 0 deletions.
Empty file added PackerUnpacker/1
Empty file.
Binary file added PackerUnpacker/Combine.txt
Binary file not shown.
1 change: 1 addition & 0 deletions PackerUnpacker/Demo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Marvellous Infosystems Pune
1 change: 1 addition & 0 deletions PackerUnpacker/Demo/Hello.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ABCDEFGHIJ
1 change: 1 addition & 0 deletions PackerUnpacker/Demo/India.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
AAAAAAAAAABBBBBBBBBB
1 change: 1 addition & 0 deletions PackerUnpacker/Demo/Logic.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
AAAAAAAAAABBBBBBBBBBCCCCCCCCCC
1 change: 1 addition & 0 deletions PackerUnpacker/FinalPAcls
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello.txt 10 ABCDEFGHIJIndia.txt 20 AAAAAAAAAABBBBBBBBBBLogic.txt 30 AAAAAAAAAABBBBBBBBBBCCCCCCCCCC
1 change: 1 addition & 0 deletions PackerUnpacker/FinalPackerUnpacker/Demo/Hello.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ABCDEFGHIJ
1 change: 1 addition & 0 deletions PackerUnpacker/FinalPackerUnpacker/Demo/India.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
AAAAAAAAAABBBBBBBBBB
1 change: 1 addition & 0 deletions PackerUnpacker/FinalPackerUnpacker/Demo/Logic.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
AAAAAAAAAABBBBBBBBBBCCCCCCCCCC
1 change: 1 addition & 0 deletions PackerUnpacker/FinalPackerUnpacker/FinalPacked.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello.txt 10 ABCDEFGHIJIndia.txt 20 AAAAAAAAAABBBBBBBBBBLogic.txt 30 AAAAAAAAAABBBBBBBBBBCCCCCCCCCC
1 change: 1 addition & 0 deletions PackerUnpacker/FinalPackerUnpacker/Hello.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ABCDEFGHIJ
1 change: 1 addition & 0 deletions PackerUnpacker/FinalPackerUnpacker/India.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
AAAAAAAAAABBBBBBBBBB
1 change: 1 addition & 0 deletions PackerUnpacker/FinalPackerUnpacker/Logic.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
AAAAAAAAAABBBBBBBBBBCCCCCCCCCC
Binary file not shown.
85 changes: 85 additions & 0 deletions PackerUnpacker/FinalPackerUnpacker/MarvellousPacker.java
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 PackerUnpacker/FinalPackerUnpacker/MarvellousUnpacker.java
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
1 change: 1 addition & 0 deletions PackerUnpacker/Hello.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ABCDEFGHIJ
1 change: 1 addition & 0 deletions PackerUnpacker/India.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
AAAAAAAAAABBBBBBBBBB
1 change: 1 addition & 0 deletions PackerUnpacker/Infosystems.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ABCDEFGHIJaaaaabbbbbcccccdddddAaaaaaaaaabbbbbbbbbbcccccccccc
1 change: 1 addition & 0 deletions PackerUnpacker/Logic.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
AAAAAAAAAABBBBBBBBBBCCCCCCCCCC
Binary file added PackerUnpacker/Marvel
Binary file not shown.
Empty file added PackerUnpacker/Marvellous
Empty file.
Binary file added PackerUnpacker/Marvellous.txt
Binary file not shown.
1 change: 1 addition & 0 deletions PackerUnpacker/MarvellousPacked.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello.txt 10 ABCDEFGHIJIndia.txt 20 AAAAAAAAAABBBBBBBBBBLogic.txt 30 AAAAAAAAAABBBBBBBBBBCCCCCCCCCC
4 changes: 4 additions & 0 deletions PackerUnpacker/NewPacked.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ABCDEFGHIJABCDEFGHIJAAAAAAAAAA
BBBBBBBBBBAAAAAAAAAA
BBBBBBBBBB
CCCCCCCCCC
1 change: 1 addition & 0 deletions PackerUnpacker/NewPacked2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ABCDEFGHIJABCDEFGHIJAAAAAAAAAABBBBBBBBBBAAAAAAAAAABBBBBBBBBBCCCCCCCCCC
1 change: 1 addition & 0 deletions PackerUnpacker/Packed.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ABCDEFGHIJ
Binary file added PackerUnpacker/Program401.class
Binary file not shown.
15 changes: 15 additions & 0 deletions PackerUnpacker/Program401.java
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 added PackerUnpacker/Program402.class
Binary file not shown.
17 changes: 17 additions & 0 deletions PackerUnpacker/Program402.java
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 added PackerUnpacker/Program403.class
Binary file not shown.
25 changes: 25 additions & 0 deletions PackerUnpacker/Program403.java
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 added PackerUnpacker/Program404.class
Binary file not shown.
25 changes: 25 additions & 0 deletions PackerUnpacker/Program404.java
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");
}

}
}
32 changes: 32 additions & 0 deletions PackerUnpacker/Program405.java
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");
}

}
}
35 changes: 35 additions & 0 deletions PackerUnpacker/Program406.java
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 added PackerUnpacker/Program408.class
Binary file not shown.
Loading

0 comments on commit cf583c4

Please sign in to comment.