(Ebook) Java Cookbook by Ian F. Darwin ISBN 9781492072584, 1492072583 pdf download
(Ebook) Java Cookbook by Ian F. Darwin ISBN 9781492072584, 1492072583 pdf download
Darwin ISBN
9781492072584, 1492072583 download
https://ebooknice.com/product/java-cookbook-32607846
https://ebooknice.com/product/java-cookbook-problems-and-solutions-
for-java-developers-final-release-10868760
https://ebooknice.com/product/java-cookbook-4703652
https://ebooknice.com/product/java-cookbook-920270
https://ebooknice.com/product/java-cookbook-problems-and-solutions-
for-java-developers-early-release-10538990
(Ebook) Android Cookbook by Ian F. Darwin ISBN 9781449388416,
1449388418
https://ebooknice.com/product/android-cookbook-2322658
https://ebooknice.com/product/android-cookbook-5903428
https://ebooknice.com/product/android-cookbook-problems-and-solutions-
for-android-developers-5908798
https://ebooknice.com/product/tomcat-the-definitive-guide-1021542
https://ebooknice.com/product/biota-grow-2c-gather-2c-cook-6661374
Java Cookbook
FOURTH EDITION
Problems and Solutions for Java Developers
Ian F. Darwin
Java Cookbook
by Ian F. Darwin Copyright © 2020 RejmiNet Group, Inc.
All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein
Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business,
or sales promotional use. Online editions are also available
for most titles (http://oreilly.com). For more information,
contact our corporate/institutional sales department: 800-
998-9938 or [email protected].
Acquisition Editor: Zan McQuade
Development Editor: Corbin Collins
Production Editor: Beth Kelly
Copyeditor: Amanda Kersey
Proofreader: Charles Roumeliotis
Indexer: Potomac Indexing, LLC
Interior Designer: David Futato
Cover Designer: Karen Montgomery
Illustrator: Rebecca Demarest
June 2001: First Edition
June 2004: Second Edition
July 2014: Third Edition
March 2020: Fourth Edition
Revision History for the Fourth Edition
2020-03-17: First Release
See http://oreilly.com/catalog/errata.csp?
isbn=9781492072584 for release details.
The O’Reilly logo is a registered trademark of O’Reilly
Media, Inc. Java Cookbook, the cover image, and related
trade dress are trademarks of O’Reilly Media, Inc.
The views expressed in this work are those of the author,
and do not represent the publisher’s views. While the
publisher and the author have used good faith efforts to
ensure that the information and instructions contained in
this work are accurate, the publisher and the author
disclaim all responsibility for errors or omissions, including
without limitation responsibility for damages resulting from
the use of or reliance on this work. Use of the information
and instructions contained in this work is at your own risk.
If any code samples or other technology this work contains
or describes is subject to open source licenses or the
intellectual property rights of others, it is your
responsibility to ensure that your use thereof complies with
such licenses and/or rights.
978-1-492-07258-4
[LSI]
Dedication
In Memoriam
Andrej Cerar Darwin 1989-2014
Son, friend, fellow writer, and craftsman.
Preface
Java Books
A lot of useful information is packed into this book.
However, due to the breadth of topics, it is not possible to
give book-length treatment to any one topic. Because of
this, the book contains references to many websites and
other books. In pointing out these references, I’m hoping to
serve my target audience: the person who wants to learn
more about Java.
O’Reilly publishes, in my opinion, the best selection of Java
books on the market. As the API continues to expand, so
does the coverage. Check out the complete list of O’Reilly’s
collection of Java books; you can buy them at most
bookstores, both physical and virtual. You can also read
them online through the O’Reilly Online Learning Platform,
a paid subscription service. And, of course, most are now
available in ebook format; O’Reilly ebooks are DRM free, so
you don’t have to worry about their copy-protection scheme
locking you into a particular device or system, as you do
with certain other publishers.
Though many books are mentioned at appropriate spots in
the book, a few deserve special mention here.
First and foremost, David Flanagan and Benjamin Evan’s
Java in a Nutshell (O’Reilly) offers a brief overview of the
language and API and a detailed reference to the most
essential packages. This is handy to keep beside your
computer. Head First Java by Bert Bates and Kathy Sierra
offers a much more whimsical introduction to the language
and is recommended for the less experienced developer.
Java 8 Lambdas (Warburton, O’Reilly) covers the Lambda
syntax introduced in Java 8 in support of functional
programming and more concise code in general.
Java 9 Modularity: Patterns and Practices for Developing
Maintainable Applications by Sander Mak and Paul Bakker
(O’Reilly) covers the important changes made in the
language in Java 9 for the Java module system.
Java Virtual Machine by Jon Meyer and Troy Downing
(O’Reilly) will intrigue the person who wants to know more
about what’s under the hood. This book is out of print but
can be found used and in libraries.
A definitive (and monumental) description of programming
the Swing GUI is Java Swing by Robert Eckstein et al.
(O’Reilly).
Java Network Programming and Java I/O, both by Elliotte
Harold (O’Reilly), are also useful references.
For Java Database work, Database Programming with JDBC
& Java by George Reese (O’Reilly) and Pro JPA 2: Mastering
the Java Persistence API by Mike Keith and Merrick
Schincariol (Apress) are recommended. Or my forthcoming
overview of Java Database.
Although the book you’re now reading doesn’t have much
coverage of the Java EE, I’d like to mention two books on
that topic:
Arun Gupta covers the Enterprise Edition in Java EE 7
Essentials (O’Reilly).
Adam Bien’s Real World Java EE Patterns: Rethinking
Best Practices offers useful insights in designing and
implementing an Enterprise application.
You can find more at the O’Reilly website.
Finally, although it’s not a book, Oracle has a great deal of
Java information on the web. This web page used to feature
a large diagram showing all the components of Java in a
“conceptual diagram.” An early version of this is shown in
Figure P-1; each colored box is a clickable link to details on
that particular technology.
Design Books
Peter Coad’s Java Design (PTR-PH/Yourdon Press)
discusses the issues of object-oriented analysis and design
specifically for Java. Coad is somewhat critical of Java’s
implementation of the observable-observer paradigm and
offers his own replacement for it.
One of the most famous books on object-oriented design in
recent years is Design Patterns by Erich Gamma, Richard
Helm, Ralph Johnson, and John Vlissides (Addison-Wesley).
These authors are often collectively called the “Gang of
Four,” resulting in their book sometimes being referred to
as the GoF book. One of my colleagues called it “the best
book on object-oriented design ever,” and I agree; at the
very least, it’s among the best.
Refactoring by Martin Fowler (Addison-Wesley) covers a lot
of “coding cleanups” that can be applied to code to improve
readability and maintainability. Just as the GoF book
introduced new terminology that helps developers and
others communicate about how code is to be designed,
Fowler’s book provided a vocabulary for discussing how it
is to be improved. But this book may be less useful than
others; many of the refactorings now appear in the
Refactoring Menu of the Eclipse IDE (see Recipe 1.3).
Two important streams of methodology theories are
currently in circulation. The first is collectively known as
Agile methods, and its best-known members are Scrum and
Extreme Programming (XP). XP (the methodology, not that
really old flavor of Microsoft’s OS) is presented in a series
of small, short, readable texts led by its designer, Kent
Beck. The first book in the XP series is Extreme
Programming Explained (Addison-Wesley). A good overview
of all the Agile methods is Jim Highsmith’s Agile Software
Development Ecosystems (Addison-Wesley).
Another group of important books on methodology,
covering the more traditional object-oriented design, is the
UML series led by “the Three Amigos” (Booch, Jacobson,
and Rumbaugh). Their major works are the UML User
Guide, UML Process, and others. A smaller and more
approachable book in the same series is Martin Fowler’s
UML Distilled.
Programming Conventions
I use the following terminology in this book. A program
means any unit of code that can be run: from a five-line
main program, to a servlet or web tier component, an EJB,
or a full-blown GUI application. Applets were Java
programs for use in a web browser; these were popular for
a while but barely exist today. A servlet is a Java component
built using Jakarta EE APIs for use in a web server,
normally via HTTP. EJBs are business-tier components built
using Jakarta APIs. An application is any other type of
program. A desktop application (a.k.a. client) interacts with
the user. A server program deals with a client indirectly,
usually via a network connection (usually HTTP/HTTPS
these days).
The examples shown are in two varieties. Those that begin
with zero or more import statements, a javadoc comment,
and a public class statement are complete examples. Those
that begin with a declaration or executable statement, of
course, are excerpts. However, the full versions of these
excerpts have been compiled and run, and the online
source includes the full versions.
Recipes are numbered by chapter and number, so, for
example, Recipe 8.1 refers to the first recipe in Chapter 8.
Typesetting Conventions
The following typographic conventions are used in this
book:
Italic
Used for commands, filenames, and example URLs. It is
also used for emphasis and to define new terms when
they first appear in the text.
Constant width
Used in code examples to show partial or complete Java
source code program listings. It is also used for class
names, method names, variable names, and other
fragments of Java code.
TIP
This element signifies a tip or suggestion.
Exploring the Variety of Random
Documents with Different Content
that part of England were already converted; and that he had begun
to pray and strive some months too late.
Then he was harassed by doubts whether the Turks were not in
the right, and the Christians in the wrong. Then he was troubled by
a maniacal impulse which prompted him to pray to the trees, to a
broomstick, to the parish bull. As yet, however, he was only entering
the Valley of the Shadow of Death. Soon the darkness grew thicker.
Hideous forms floated before him. Sounds of cursing and wailing
were in his ears. His way ran through stench and fire, close to the
mouth of the bottomless pit. He began to be haunted by a strange
curiosity about the unpardonable sin, and by a morbid longing to
commit it. But the most frightful of all the forms which his disease
took was a propensity to utter blasphemy, and especially to
renounce his share in the benefits of the redemption. Night and day,
in bed, at table, at work, evil spirits, as he imagined, were repeating
close to his ear the words, “Sell him, sell him.” He struck at the
hobgoblins; he pushed them from him; but still they were ever at his
side. He cried out in answer to them, hour after hour: “Never, never;
not for thousands of worlds; not for thousands.” At length, worn out
by this long agony, he suffered the fatal words to escape him, “Let
him go, if he will.” Then his misery became more fearful than ever.
He had done what could not be forgiven. He had forfeited his part of
the great sacrifice. Like Esau, he had sold his birthright; and there
was no longer any place for repentance. “None,” he afterwards
wrote, “knows the terrors of those days but myself.” he has
described his sufferings with singular energy, simplicity, and pathos,
he envied the brutes; he envied the very stones in the street, and
the tiles on the houses. The sun seemed to withhold its light and
warmth from him. His body, though cast in a sturdy mould, and
though still in the highest vigour of youth, trembled whole days
together with the fear of death and judgment. He fancied that this
trembling was the sign set on the worst reprobates, the sign which
God had put on Cain. The unhappy man’s emotion destroyed his
power of digestion. He had such pains that he expected to burst
asunder like Judas, whom he regarded as his prototype.
Neither the books which Bunyan read, nor the advisers whom he
consulted, were likely to do much good in a case like his. His small
library had received a most unseasonable addition, the account of
the lamentable end of Francis Spira. One ancient man of high repute
for piety, whom the sufferer consulted, gave an opinion which might
well have produced fatal consequences. “I am afraid,” said Bunyan,
“that I have committed the sin against the Holy Ghost.”
“Indeed,” said the old fanatic, “I am afraid that you have.”
At length the clouds broke; the light became clearer and clearer;
and the enthusiast, who had imagined that he was branded with the
mark of the first murderer, and destined to the end of the arch
traitor, enjoyed peace and a cheerful confidence in the mercy of
God. Years elapsed, however, before his nerves, which had been so
perilously overstrained, recovered their tone.
When he had joined a Baptist society at Bedford, and was for the
first time admitted to partake of the Eucharist, it was with difficulty
that he could refrain from imprecating destruction on his brethren
while the cup was passing from hand to hand. After he had been
some time a member of the congregation, he began to preach; and
his sermons produced a powerful effect. He was indeed illiterate; but
he spoke to illiterate men. The severe training through which he had
passed had given him such an experimental knowledge of all the
modes of religious melancholy as he could never have gathered from
books; and his vigorous genius, animated by a fervent spirit of
devotion, enabled him, not only to exercise a great influence over
the vulgar, but even to extort the half contemptuous admiration of
scholars. Yet it was long before he ceased to be tormented by an
impulse which urged him to utter words of horrible impiety in the
pulpit.
Counter-irritants are of as great use in moral as in physical
diseases. It should seem that Bunyan was finally relieved from the
internal sufferings which had embittered his life by sharp persecution
from without. He had been five years a preacher, when the
Restoration put it in the power of the Cavalier gentlemen and
clergymen all over the country to oppress the Dissenters; and, of all
the Dissenters whose history is known to us, he was perhaps the
most hardly treated. In November 1660, he was flung into Bedford
gaol; and there he remained, with some intervals of partial and
precarious liberty, during twelve years. His persecutors tried to
extort from him a promise that he would abstain from preaching; but
he was convinced that he was divinely set apart and commissioned
to be a teacher of righteousness: and he was fully determined to
obey God rather than man. He was brought before several tribunals,
laughed at, caressed, reviled, menaced, but in vain. He was
facetiously told that he was quite right in thinking that he ought not
to hide his gift: but that his real gift was skill in repairing old kettles.
He was compared to Alexander the coppersmith. he was told that, if
he would give up preaching, he should be instantly liberated. He was
warned that, if he persisted in disobeying the law, he would be liable
to banishment, and that, if he were found in England after a certain
time, his neck would be stretched. His answer was, “If you let me
out to-day, I will preach again tomorrow.” Year after year he lay
patiently in a dungeon, compared with which the worst prison now
to be found in the island is a palace. His fortitude is the more
extraordinary, because his domestic feelings were unusually strong.
Indeed, he was considered by his stern brethren as somewhat too
fond and indulgent a parent. He had several small children, and
among them a daughter who was blind, and whom he loved with
peculiar tenderness. He could not, he said, bear even to let the wind
blow on her; and now she must suffer cold and hunger: she must
beg; she must be beaten; “yet,” he added, “I must, I must do it.”
While he lay in prison he could do nothing in the way of his old trade
for the support of his family. He determined, therefore, to take up a
new trade. He learned to make long tagged thread laces; and many
thousands of these articles were furnished by him to the hawkers.
While his hands were thus busied, he had other employment for his
mind and his lips. He gave religious instruction to his fellow-captives,
and formed from among them a little flock, of which he was himself
the pastor. He studied indefatigably the few books which he
possessed. His two chief companions were the Bible and Fox’s Book
of Martyrs. His knowledge of the Bible was such that he might have
been called a living concordance; and on the margin of his copy of
the Book of Martyrs are still legible the ill spelt lines of doggrel in
which he expressed his reverence for the brave sufferers, and his
implacable enmity to the mystical Babylon.
At length he began to write; and, though it was some time before
he discovered where his strength lay, his writings were not
unsuccessful. They were coarse, indeed; but they showed a keen
mother wit, a great command of the homely mother tongue, an
intimate knowledge of the English Bible, and a vast and dearly
bought spiritual experience. They therefore, when the corrector of
the press had improved the syntax and the spelling, were well
received by the humbler class of Dissenters.
Much of Bunyan’s time was spent in controversy. He wrote sharply
against the Quakers, whom he seems always to have held in utter
abhorrence. It is, however, a remarkable fact that he adopted one of
their peculiar fashions: his practice was to write, not November or
December, but eleventh month and twelfth month.
He wrote against the liturgy of the Church of England. No two
things, according to him, had less affinity than the form of prayer
and the spirit of prayer. Those, he said with much point, who have
most of the spirit of prayer are all to be found in gaol; and those
who have most zeal for the form of prayer are all to be found at the
alehouse. The doctrinal articles, on the other hand, he warmly
praised, and defended against some Arminian clergymen who had
signed them. The most acrimonious of all his works is his answer to
Edward Fowler, afterwards Bishop of Gloucester, an excellent man,
but not free from the taint of Pelagianisin.
Banyan had also a dispute with some of the chiefs of the sect to
which he belonged. He doubtless held with perfect sincerity the
distinguishing tenet of that sect; but he did not consider that tenet
as one of high importance, and willingly joined in communion with
quiet Presbyterians and Independents. The sterner Baptists,
therefore, loudly pronounced him a false brother. A controversy
arose which long survived the original combatants. In our own time
the cause which Bunyan had defended with rude logic and rhetoric
against Kiffin and Danvers was pleaded by Robert Hall with an
ingenuity and eloquence such as no polemical Writer has ever
surpassed.
During the years which immediately followed the
Restoration, Bunyan’s confinement seems to have been strict. But,
as the passions of 1660 cooled, as the hatred with which the
Puritans had been regarded while their reign was recent gave place
to pity, he was less and less harshly treated. The distress of his
family, and his own patience, courage, and piety softened the hearts
of his persecutors. Like his own Christian in the cage, he found
protectors even among the crowd of Vanity Fair. The bishop of the
diocese, Dr. Barlow, is said to have interceded for him. At length the
prisoner was suffered to pass most of his time beyond the walls of
the gaol, on condition, as it should seem, that he remained within
the town of Bedford.
He owed his complete liberation to one of the worst acts of one of
the worst governments that England has ever seen. In 1671 the
Cabal was in power. Charles II. had concluded the treaty by which
he bound himself to set up the Roman Catholic religion in England.
The first step which he took towards that end was to annul, by an
unconstitutional exercise of his prerogative, all the penal statutes
against the Roman Catholics; and, in order to disguise his real
design, he annulled at the same time the penal statutes against
Protestant nonconformists. Bunyan was consequently set at large. In
the first warmth of his gratitude he published a tract in which he
compared Charles to that humane and generous Persian king who,
though not himself blessed with the light of the true religion,
favoured the chosen people, and permitted them, after years of
captivity, to rebuild their beloved temple. To candid men, who
consider how much Bunyan had suffered, and how little he could
guess the secret designs of the court, the unsuspicious thankfulness
with which he accepted the precious boon of freedom will not
appear to require any apology.
Before he left his prison he had begun the book which has made
his nane immortal. The history of that book is remarkable. The
author was, as he tells us, writing a treatise, in which he had
occasion to speak of the stages of the Christian progress. He
compared that progress, as many others had compared it, to a
pilgrimage. Soon his quick wit discovered innumerable points of
similarity which had escaped his predecessors. Imams came
crowding on his mind faster than he could put them into words,
quagmires and pits, steep hills, dark and horrible glens, soft vales,
sunny pastures, a gloomy castle of which the courtyard was strewn
with the skulls and bones of murdered prisoners, a town all bustle
and splendour, like London on the Lord Mayor’s Day, and the narrow
path, straight as a rule could make it, running on up hill and down
hill, through city and through wilderness, to the Black River and the
Shining Gate. He had found out, as most people would have said, by
accident, as he would doubtless have said, by the guidance of
Providence, where his powers lay. He had no suspicion, indeed, that
he was producing a masterpiece. He could not guess what place his
allegory would occupy in English literature; for of English literature
he knew nothing. Those who suppose him to have studied the Fairy
Queen might easily be confuted, if this were the proper place for a
detailed examination of the passages in which the two allegories
have been thought to resemble each other. The only work of fiction,
in all probability, with which he could compare his pilgrim, was his
old favourite, the legend of Sir Bevis of Southampton. He would
have thought it a sin to borrow any time from the serious business
of his life, from his expositions, his controversies, and his lace tags,
for the purpose of amusing himself with what he considered merely
as a trifle. It was only, he assures us, at spare moments that he
returned to the House Beautiful, the Delectable Mountains, and the
Enchanted Ground. He had no assistance. Nobody but himself saw a
line till the whole was complete. He then consulted his pious friends.
Some were pleased. Others were much scandalised. It was a vain
story, a mere romance, about giants, and lions, and goblins, and
warriors, sometimes fighting with monsters and sometimes regaled
by fair ladies in stately palaces. The loose atheistical wits at Will’s
might write such stuff to divert the painted Jezebels of the court: but
did it become a minister of the gospel to copy the evil fashions of
the world? There had been a time when the cant of such fools would
have made Bunyan miserable. But that time was passed; and his
mind was now in a firm and healthy state. He saw that, in employing
fiction to make truth clear and goodness attractive, he was only
following the example which every Christian ought to propose to
himself; and he determined to print.
The Pilgrim’s Progress stole silently into the world. Not a single
copy of the first edition is known to be in existence. The year of
publication has not been ascertained. It is probable that, during
some months, the little volume circulated only among poor and
obscure sectaries. But soon the irresistible charm of a book which
gratified the imagination of the reader with all the action and
scenery of a fairy tale, which exercised Ins ingenuity by setting him
to discover a multitude of curious analogies, which interested his
feelings for human beings, frail like himself, and struggling with
temptations from within and from without, which every moment
drew a smile from him by some stroke of quaint yet simple
pleasantry, and nevertheless left on his mind a sentiment of
reverence for God and of sympathy for man, began to produce its
effect. In puritanical circles, from which plays and novels were
strictly excluded, that effect was such as no work of genius, though
it were superior to the Iliad, to Don Quixote, or to Othello, can ever
produce on a mind accustomed to indulge in literary luxury. In 1678
came forth a second edition with additions; and then the demand
became immense. In the four following years the book was reprinted
six times. The eighth edition, which contains the last improvements
made by the author, was published in 1682, the ninth in 1684, the
tenth in 1685. The help of the engraver had early been called in;
and tens of thousands of children looked with terror and delight on
execrable copperplates, which represented Christian thrusting his
sword into Apollyon, or writhing in the grasp of Giant Despair. In
Scotland, and in some of the colonies, the Pilgrim was even more
popular than in his native country. Bunyan has told us, with very
pardonable vanity, that in New England his dream was the daily
subject of the conversation of thousands, and was thought worthy to
appear in the most superb binding. He had numerous admirers in
Holland, and amoung the Huegonots of France. With the pleasures,
however, he experienced some of the pains of eminence. Knavish
booksellers put forth volumes of trash under his name; and envious
scribblers maintained it to be impossible that the poor ignorant
tinker should really be the author of the book which was called his.
He took the best way to confound both those who counterfeited
him and those who slandered him. He continued to work the gold-
field which he had discovered, and to draw from it new treasures,
not indeed with quite such ease and in quite such abundance as
when the precious soil was still virgin, but yet with success which left
all competition far behind. In 1684 appeared the second part of the
“Pilgrim’s Progress.” It was soon followed by the “Holy War,” which, if
the “Pilgrim’s Progress” did not exist, would be the best allegory that
ever was written.
Bunyan’s place in society was now very different from what it had
been. There had been a time when many Dissenting ministers, who
could talk Latin and read Greek, had affected to treat him with
scorn. But his fame and influence now far exceeded theirs. He had
so great an authority among the Baptists that he was popularly
called Bishop Banyan. His episcopal visitations were annual. From
Bedford he rode every year to London, and preached there to large
and attentive congregations. From London he went his circuit
through the country, animating the zeal of his brethren, collecting
and distributing alms, and making up quarrels. The magistrates
seem in general to have given him little trouble. But there is reason
to believe that, in the year 1685, he was in some danger of again
occupying his old quarters in Bedford gaol. In that year the rash and
wicked enterprise of Monmouth gave the Government a pretext for
prosecuting the Nonconformists; and scarcely one eminent divine of
the Presbyterian, Independent, or Baptist persuasion remained
unmolested. Baxter was in prison: Howe was driven into exile: Henry
was arrested. Two eminent Baptists, with whom Bunyan had been
engaged in controversy, were in great peril and distress. Danvers
was in danger of being hanged: and Kiffin’s grandsons were actually
hanged. The tradition is that, during those evil days, Bunyan was
forced to disguise himself as a waggoner, and that he preached to
his congregation at Bedford in a smock-frock, with a cart-whip in his
hand. But soon a great change took place. James the Second was at
open war with the church, and found it necessary to court the
Dissenters. Some of the creatures of the government tried to secure
the aid of Bunyan. They probably knew that he had written in praise
of the indulgence of 1672, and therefore hoped that he might be
equally pleased with the indulgence of 1687. But fifteen years of
thought, observation, and commerce with the world had made him
wiser. Nor were the cases exactly parallel. Charles was a professed
Protestant: James was a professed Papist. The object of Charles’s
indulgence was disguised: the object of James’s indulgence was
patent. Bunyan was not deceived, he exhorted his hearers to
prepare themselves by fasting and prayer for the danger which
menaced their civil and religious liberties, and refused even to speak
to the courtier who came down to remodel the corporation of
Bedford, and who, as was supposed, had it in charge to offer some
municipal dignity to the Bishop of the Baptists.
Bunyan did not live to see the Revolution. In the summer of 1688
he undertook to plead the cause of a son with an angry father, and
at length prevailed on the old man not to disinherit the young one.
This good work cost the benevolent intercessor his life. He had to
ride through heavy rain. He came drenched to his lodgings on Snow
Hill, was seized with a violent fever, and died in a few days. He was
buried in Bunhill Fields; and the spot where he lies is still regarded
by the Nonconformists with a feeling which, seems scarcely in
harmony with the stern spirit of their theology. Many puritans, to
whom the respect paid by Roman Catholics to the reliques and
tombs of saints seemed childish or sinful, are said to have begged
with their dying breath that their coffins might be placed as near as
possible to the coffin of the author of the “Pilgrim’s Progress.”
The fame of Bunyan during his life, and during the century which
followed his death, was indeed great, but was almost entirely
confined to religious families of the middle and lower classes. Very
seldom was he during that time mentioned with respect by any
writer of great literary eminence. Young coupled his prose with the
poetry of the wretched D’Urfey. In the Spiritual Quixote, the
adventures of Christian are ranked with those of Jack the Giant-Killer
and John Hickathrift. Cowper ventured to praise the great allegorist,
but did not venture to name him. It is a significant circumstance
that, till a recent period, all the numerous editions of the “Pilgrim’s
Progress” were evidently meant for the cottage and the servants’
hall. The paper, the printing, the plates, were all of the meanest
description. In general, when the educated minority and the
common people differ about the merit of a book, the opinion of the
educated minority finally prevails. The “Pilgrim’s Progress” is perhaps
the only book about which, after the lapse of a hundred years, the
educated minority has come over to the opinion of the common
people.
The attempts which have been made to improve and to imitate
this book are not to be numbered. It has been done into verse: it
has been done into modern English. “The Pilgrimage of Tender
Conscience,” the “Pilgrimage of Good Intent,” “The Pilgrimage of
Seek Truth,” “The Pilgrimage of Theophilus,” “The Infant Pilgrim,”
“The Hindoo Pilgrim,” are among the many feeble copies of the great
original. But the peculiar glory of Bunyan is that those who most
hated his doctrines have tried to borrow the help of his genius. A
Catholic version of his parable may be seen with the head of the
Virgin in the title page. On the other hand, those Antinomians for
whom his Calvinism is not strong enough may study the pilgrimage
of Hephzibah, in which nothing will be found which can be construed
into an admission of free agency and universal redemption. But the
most extraordinary of all the acts of Vandalism by which a fine work
of art was ever defaced was committed so late as the year 1853. It
was determined to transform the “Pilgrim’s Progress” into a
Tractarian book. The task was not easy: for it was necessary to
make the two sacraments the most prominent objects in the
allegory; and of all Christian theologians, avowed Quakers excepted,
Bunyan was the one in whose system the sacraments held the least
prominent place. However, the Wicket Gate became a type of
Baptism, and the House Beautiful of the Eucharist. The effect of this
change is such as assuredly the ingenious person who made it never
contemplated. For, as not a single pilgrim passes through the Wicket
Gate in infancy, and as Faithful hurries past the House Beautiful
without stopping, the lesson, which the fable in its altered shape
teaches, is that none but adults ought to be baptized, and that the
Eucharist may safely be neglected. Nobody would have discovered
from the original “Pilgrim’s Progress” that the author was not a
Pædobaptist. To turn his book into a book against Pædobaptism was
an achievement reserved for an Anglo-Catholic divine. Such blunders
must necessarily be committed by every man who mutilates parts of
a great work, without taking a comprehensive view of the whole.
OLIVER GOLDSMITH.
(Encyclopaedia Britannica, February 1856.)
O
liver Goldsmith, one of the most pleasing English writers of
the eighteenth century. He was of a Protestant and Saxon
family which had been long settled in Ireland, and which had,
like most other Protestant and Saxon families, been, in troubled
times, harassed and put in fear by the native population. His father,
Charles Goldsmith, studied in the reign of Queen Anne at the
diocesan school of Elphin, became attached to the daughter of the
schoolmaster, married her, took orders, and settled at a place called
Pallas in the county of Longford. There he with difficulty supported
his wife and children on what he could earn, partly as a curate and
partly as a farmer.
At Pallas Oliver Goldsmith was born in November 1728. The spot
was then, for all practical purposes, almost as remote from the busy
and splendid capital in which his later years were passed, as any
clearing in Upper Canada or any sheep-walk in Australasia now is.
Even at this day those enthusiasts who venture to make a pilgrimage
to the birthplace of the poet are forced to perform the latter part of
their journey on foot. The hamlet lies far from any high road, on a
dreary plain which, in wet weather, is often a lake. The lanes would
break any jaunting ear to pieces; and there are ruts and sloughs
through which the most strongly built wheels cannot be dragged.
While Oliver was still a child, his father was presented to a living
worth about 200l. a year, in the county of Westmeath. The family
accordingly quitted their cottage in the wilderness for a spacious
house on a frequented road, near the village of Lissoy. Here the boy
was taught his letters by a maid-servant, and was sent in his
seventh year to a village school kept by an old quartermaster on
half-pay, who professed to teach nothing but reading, writing and
arithmetic, but who had an inexhaustible fund of stories about
ghosts, banshees and fairies, about the great Rapparee chiefs,
Baldearg O’Donnell and galloping Hogan, and about the exploits of
Peterborough and Stanhope, the surprise of Monjuich, and the
glorious disaster of Brihuega.
This man must have been of the Protestant religion; but he was of
the aboriginal race, and not only spoke the Irish language, but could
pour forth unpremeditated Irish verses. Oliver early became, and
through life continued to be, a passionate admirer of the Irish music,
and especially of the compositions of Carolan, some of the last notes
of whose harp he heard. It ought to be added that Oliver, though by
birth one of the Englishry, and though connected by numerous ties
with the Established Church, never showed the least sign of that
contemptuous antipathy with which, in his days, the ruling minority
in Ireland too generally regarded the subject majority. So far indeed
was he from sharing in the opinions and feelings of the caste to
which he belonged, that he conceived an aversion to the Glorious
and Immortal Memory, and, even when George the Third was on the
throne, maintained that nothing but the restoration of the banished
dynasty could save the country.
From the humble academy kept by the old soldier Goldsmith was
removed in his ninth year. He went to several grammar-schools, and
acquired some knowledge of the ancient languages. His life at this
time seems to have been far from happy. He had, as appears from
the admirable portrait of him at Knowle, features harsh even to
ugliness. The small-pox had set its mark on him with more than
usual severity. His stature was small, and his limbs ill put together.
Among boys little tenderness is shown to personal defects; and the
ridicule excited by poor Oliver’s appearance was heightened by a
peculiar simplicity and a disposition to blunder which he retained to
the last. He became the common butt of boys and masters, was
pointed at as a fright in the play-ground, and flogged as a dunce in
the school-room. When he had risen to eminence, those who had
once derided him ransacked their memory for the events of his early
years, and recited repartees and couplets which had dropped from
him, and which, though little noticed at the time, were supposed, a
quarter of a century later, to indicate the powers which produced the
“Vicar of Wakefield” and the “Deserted Village.”
In his seventeenth year Oliver went up to Trinity College, Dublin,
as a sizar. The sizars paid nothing for food and tuition, and very little
for lodging; but they had to perform some menial services from
which they have long been relieved. They swept the court: they
carried up the dinner to the fellows’ table, and changed the plates
and poured out the ale of the rulers of the society. Goldsmith was
quartered, not alone, in a garret, on the window of which his name,
scrawled by himself, is still read with interest. (1) From such garrots
many men of less parts than his have made their way to the wool-
sack or to the episcopal bench. But Goldsmith, while he suffered all
the humiliations, threw away all the advantages, of his situation. He
neglected the studies of the place, stood low at the examinations,
was turned down to the bottom of his class for playing the buffoon
in the lecture room, was severely reprimanded for pumping on a
constable, and was caned by a brutal tutor for giving a ball in the
attic story of the college to some gay youths and damsels from the
city.
While Oliver was leading at Dublin a life divided between squalid
distress and squalid dissipation, his father died, leaving a mere
pittance. The youth obtained his bachelor’s degree, and left the
university. Durum some time the humble dwelling to which his
widowed mother had retired was his home. He was now in his
twenty-first year; it was necessary that he should do something; and
his education seemed to have fitted him to do nothing but to dress
himself in gaudy colours, of which he was as fond as a magpie, to
take a hand at cards, to sing Irish airs, to play the flute, to angle in
summer, and to tell ghost stories by the fire in winter. He tried five
or six professions in turn without success. He applied for ordination;
but, as he applied in scarlet clothes, he was speedily turned out of
the episcopal palace. He then became tutor in an opulent family, but
soon quitted his situation in consequence of a dispute about play.
Then he determined
(2) Mr. Black has pointed out that this is inaccurate: the
life of Nash has been twice reprinted; once in Mr. Prior’s
edition (vol. iii. p. 249), and once in Mr. Cunningham’s
edition (vol. iv. p. 351.
S
amuel Johnson, one of the most eminent English writers of the
eighteenth century, was the son of Michael Johnson, who was,
at the beginning of that century, a magistrate of Lichfield, and
a bookseller of great note in the midland counties. Michael’s abilities
and attainments seem to have been considerable. He was so well
acquainted with the contents of the volumes which he exposed to
sale, that the country rectors of Staffordshire and Worcestershire
thought him an oracle on points of learning. Between him and the
clergy, indeed, there was a strong religious and political sympathy.
He was a zealous churchman, and, though he had qualified himself
for municipal office by taking the oaths to the sovereigns in
possession, was to the last a Jacobite in heart. At his house, a house
which is still pointed out to every traveller who visits Lichfield,
Samuel was born on the 18th of September 1709. In the child, the
physical, intellectual, and moral peculiarities which afterwards
distinguished the man were plainly discernible; great muscular
strength accompanied by much awkwardness and many infirmities;
great quickness of parts, with a morbid propensity to sloth and
procrastination; a kind and generous heart, with a gloomy and
irritable temper. He had inherited from his ancestors a scrofulous
taint, which it was beyond the power of medicine to remove. His
parents were weak enough to believe that the royal touch was a
specific for this malady. In his third year he was taken up to London,
inspected by the court surgeon, prayed over by the court chaplains,
and stroked and presented with a piece of gold by Queen Anne. One
of his earliest recollections was that of a stately lady in a diamond
stomacher and a long black hood. Her hand was applied in vain. The
boy’s features, which were originally noble and not irregular, were
distorted by his malady. His cheeks were deeply scarred. He lost for
a time the sight of one eye; and he saw but very imperfectly with
the other. But the force of his mind overcame every impediment.
Indolent as he was, he acquired knowledge with such ease and
rapidity that at every school to which he was sent he was soon the
best scholar. From sixteen to eighteen he resided at home, and was
left to his own devices. He learned much at this time, though his
studies were without guidance and without plan. He ransacked his
father’s shelves, dipped into a multitude of books, read what was
interesting, and passed over what was dull. An ordinary lad would
have acquired little or no useful knowledge in such a way: but much
that was dull to ordinary lads was interesting to Samuel. He read
little Greek; for his proficiency in that language was not such that he
could take much pleasure in the masters of Attic poetry and
eloquence. But he had left school a good Latinist; and he soon
acquired, in the large and miscellaneous library of which he now had
the command, an extensive knowledge of Latin literature. That
Augustan delicacy of taste which is the boast of the great public
schools of England he never possessed. But he was early familiar
with some classical writers who were quite unknown to the best
scholars in the sixth form at Eton. He was peculiarly attracted by the
works of the great restorers of learning. Once, while searching for
some apples, he found a large folio volume of Petrarch’s works. The
name excited his curiosity; and he eagerly devoured hundreds of
pages. Indeed, the diction and versification of his own Latin
compositions show that he had paid at least as much attention to
modern copies from the antique as to the original models.
While he was thus irregularly educating himself, his family was
sinking into hopeless poverty. Old Michael Johnson was much better
qualified to pore upon books, and to talk about them, than to trade
in them. His business declined; his debts increased; it was with
difficulty that the daily expenses of his household were defrayed. It
was out of his power to support his son at either university: but a
wealthy neighbour offered assistance; and, in reliance on promises
which proved to be of very little value, Samuel was entered at
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebooknice.com