jbackup/src/main/java/org/jbundle/jbackup/util/Util.java
public static int copyStream(InputStream inStream, OutputStream outStream, boolean bCountInBytes, boolean bCountOutBytes)
		throws IOException
	{
		byte rgBytes[] = new byte[8192];
		int iTotalLength = 0;
		int iStartInByte = 0;
		int iStartOutByte = 0;
		while (true)
		{
			int iLength = rgBytes.length;
			if (bCountInBytes)
				iStartInByte = iTotalLength;
			iLength = inStream.read(rgBytes, iStartInByte, iLength);
			if (DEBUG)
				System.out.println("inLen = " + iLength);
			if (iLength <= 0)
				break;
			if (bCountOutBytes)
				iStartOutByte = iTotalLength;
			outStream.write(rgBytes, iStartOutByte, iLength);
			iTotalLength += iLength;
		}
		return iTotalLength;
	}
public static int copyStream(InputStream inStream, OutputStream outStream, boolean bCountInBytes, boolean bCountOutBytes)
		throws IOException
	{
		byte rgBytes[] = new byte[8192];
		int iTotalLength = 0;
		int iStartInByte = 0;
		int iStartOutByte = 0;
		while (true)
		{
			int iLength = rgBytes.length;
			if (bCountInBytes)
				iStartInByte = iTotalLength;
			iLength = inStream.read(rgBytes, iStartInByte, iLength);
			if (DEBUG)
				System.out.println("inLen = " + iLength);
			if (iLength <= 0)
				break;
			if (bCountOutBytes)
				iStartOutByte = iTotalLength;
			outStream.write(rgBytes, iStartOutByte, iLength);
			iTotalLength += iLength;
		}
		return iTotalLength;
	}
public static int copyStream ( InputStream inStream , OutputStream outStream , boolean bCountInBytes , boolean bCountOutBytes ) throws IOException { byte rgBytes [ ] = new byte [ 8192 ] ; int iTotalLength = 0 ; int iStartInByte = 0 ; int iStartOutByte = 0 ; while ( true ) { int iLength = rgBytes . length ; if ( bCountInBytes ) iStartInByte = iTotalLength ; iLength = inStream . read ( rgBytes , iStartInByte , iLength ) ; if ( DEBUG ) System . out . println ( "inLen = " + iLength ) ; if ( iLength <= 0 ) break ; if ( bCountOutBytes ) iStartOutByte = iTotalLength ; outStream . write ( rgBytes , iStartOutByte , iLength ) ; iTotalLength += iLength ; } return iTotalLength ; }
/*
Copy the input stream to the output stream.
@param inStream Input stream.
@param outStream Output stream.
@return Error code, or 0 if no errors.
/ * Copy the input stream to the output stream .