All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fr.lteconsulting.hexa.server.tools.StreamTools Maven / Gradle / Ivy

The newest version!
package fr.lteconsulting.hexa.server.tools;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class StreamTools
{
	public static boolean copyStream( InputStream input, OutputStream output )
	{
		try
		{
			int size = 4096;
			byte[] buffer = new byte[size];

			int read = 0;
			do
			{
				read = input.read( buffer );
				if( read > 0 )
					output.write( buffer, 0, read );
			}
			while( read == size );

			return true;
		}
		catch( IOException e )
		{
			return false;
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy