This commit is contained in:
2024-08-07 09:16:27 -04:00
parent fdfadd5c7e
commit 5f971cf684
5200 changed files with 731717 additions and 0 deletions

75
java/COUNTER/Infile.java Normal file
View File

@@ -0,0 +1,75 @@
import java.net.*;
import java.io.*;
class InFile
{
private boolean mIsOkay;
private URL mInFile;
private URLConnection mConnection;
private DataInputStream mInData;
private String mStrLine;
public InFile()
{
mIsOkay=false;
}
public InFile(URL resBase,String strHostPathFileName)throws Exception
{
mIsOkay=false;
open(resBase,strHostPathFileName);
}
public InFile(String strHostPathFileName)throws Exception
{
mIsOkay=false;
open(strHostPathFileName);
}
public InFile(String resBase,String strHostPathFileName)throws Exception
{
mIsOkay=false;
open(resBase,strHostPathFileName);
}
public void open(URL resBase,String strHostPathFileName)throws Exception
{
close();
try{mInFile=new URL(resBase,strHostPathFileName);}
catch(MalformedURLException exception){throw new Exception();}
try{mConnection=mInFile.openConnection();}
catch(Exception exception){throw new Exception();}
try{mInData=new DataInputStream(mConnection.getInputStream());}
catch(Exception exception){throw new Exception();}
mIsOkay=true;
}
public void open(String resBase,String strHostPathFileName)throws Exception
{
open(resBase+strHostPathFileName);
}
public void open(String strHostPathFileName)throws Exception
{
close();
try{mInFile=new URL(strHostPathFileName);}
catch(MalformedURLException exception){throw new Exception();}
try{mConnection=mInFile.openConnection();}
catch(IOException ioException){throw new Exception();}
try{mInData=new DataInputStream(mConnection.getInputStream());}
catch(Exception exception){throw new Exception();}
mIsOkay=true;
}
public void close()
{
if(!isOkay())return;
try{mInData.close();}
catch(Exception exception){;}
mIsOkay=false;
}
public String readLine()throws Exception
{
if(!isOkay())throw new Exception();
try{mStrLine=new String(mInData.readLine());}
catch(IOException ioException){throw new Exception();}
return mStrLine;
}
public boolean isOkay()
{
return mIsOkay;
}
};