Friday, March 20, 2020

Capital Punishment misc6 essays

Capital Punishment misc6 essays Many people support the death penalty, and a lot of them use the defense that comes from the Bible: an eye for eye, and a limb for a limb. I on the otherhand believe otherwise. Punishment by death, in my opinion, is a very barbaric way of penalization . In the world, it is known that at least 2500 prisoners are executed in at least 37 different countries, on an annual basis. There will be various statistics, opinions, history, and background information discussed through out the residuum of this thesis. The history of the death penalty, dates back to the days of Hammurabi and his code to the days of the present. The methods nowadays are certainly different, but the objective and goal has remained the same. The earliest known date of any form of organized capital punishment was in 1750 B.C., with Hammurabi and his code. The Bible prescribed death for more than 30 different crimes, including: murder, treason, theft, arson, and rape, to name a few. In the Medieval Times, treason ( grand and petty ) murder, larceny, rape, and arson were all crimes recognized as punishable by death. During the reigns of King Canute and William the Conqueror, it was not used at all. By 1800, though, more than 200 crimes were construed as punishable by death, but most were commuted by a royal pardon. In the American Colonies, in the years before the Revolution, it was commonly for a wide variety of offenses. Near the end of the 18th century, though, efforts to abolish it arose in Europe. It was led mainly by the Quakers, who believed in non-violence all together. Then when influential documents arose, it prompted and inspired the great French philosopher, Voltaire, to oppose it At the present there are many fundamental questions raised pertaining to the fact that with the death penalty intact and fully operational, isnt the government condoning killing. Also, isnt the government b...

Wednesday, March 4, 2020

How to Read and Write Byte Streams in Java

How to Read and Write Byte Streams in Java Reading and writing binary streams is one of the most common I/O tasks a Java application can perform. It can be performed by looking at each individual byte in a stream or by using a more structured buffered approach. Note: This article looks at reading binary data from a example.jpg file. If you try this code then simply replace the name of the example.jpg with the path and name of a jpeg file on your computer. Byte by Byte The java.ioclass was the first Java api to provide Input/Output functionality. It has two methods that can be used to input and output byte streams (blocks of 8 bits) from and to a file. These classes are the FileInputStream and FileOutputStream. These methods provide a basic method of I/O by allowing a file to be input or output one byte at a time.  In practice its better to use a buffered method for binary streams but its good to look at the most basic building block of the Java I/O functionality. Notice how we place the I/O handling inside a try, catch, finallyblock- this is to make sure we handle IO exceptions and to properly close the streams. The catch block will show any I/O exceptions that occur and print a message for the user. In the finally block its important to close the streams explicitly by calling the close method otherwise they will remain open and a waste of resources. There is a check to see if the FileInputStreamand FileOutputStreamare null before attempting to close. This is because an I/O error could occur before the streams are initialized. For example, if the file name is incorrect the stream will not be opened properly.In the tryblock we can add code to read in the bytes:The readmethod reads in one byte from the FileInputStreamand the write method writes one byte to the FileOutputStream. When the end of the file is reached and there are no more bytes to input the value of -1 is returned. Now that Java 7 has been released you can see the benefit of one of its new features- the try with resources block. This means that if we identify the streams to the try block at the beginning it will handle closing the stream for us. This eliminates the need for the finally block in the previous example: The full Java code listings for the two versions of the byte reading program can be found in Binary Stream Example Code.