没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
An Introduction to Network
Programming with Java
www.dbeBooks.com - An Ebook Library
Jan Graba
An Introduction to Network
Programming with Java
Jan Graba, BA, PGCE, MSc
Faculty of ACES
Sheffield Hallam University
UK
British Library Cataloguing in Publication Data
A catalogue record for this book is available from the British Library
Library of Congress Control Number: 2006923894
ISBN-10: 1-84628-380-9
ISBN-13: 978-1-84628-380-2
Printed on acid-free paper
© Jan Graba 2007
New and revised edition of An Introduction to Network Programming with Java published by Addison
Wesley, 2003, ISBN 0321116143
Sun, Sun Microsystems, the Sun Logo, the Java programming language, J2SE 5.0, and JavaBeans are
trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries.
Microsoft, Encarta, MSN, and Windows are either registered trademarks or trademarks of Microsoft
Corporation in the United States and/or other countries.
Apart from any fair dealing for the purposes of research or private study, or criticism or review, as
permitted under the Copyright, Designs and Patents Act 1988, this publication may only be reproduced,
stored or transmitted, in any form or by any means, with the prior permission in writing of the publish-
ers, or in the case of reprographic reproduction in accordance with the terms of licences issued by the
Copyright Licensing Agency. Enquiries concerning reproduction outside those terms should be sent to
the publishers.
The use of registered names, trademarks, etc. in this publication does not imply, even in the absence of
a specific statement, that such names are exempt from the relevant laws and regulations and therefore
free for general use.
The publisher makes no representation, express or implied, with regard to the accuracy of the information
contained in this book and cannot accept any legal responsibility or liability for any errors or omissions
that may be made.
Whilst we have made considerable efforts to contact all holders of copyright material contained in this
book, we may have failed to locate some of them. Should holders wish to contact the Publisher, we will
be happy to come to some arrangement with them.
Printed in the United States of America (SB)
987654321
Springer Science+Business Media, LLC
springer.com
Preface
The market in general-purpose Java texts is an exceptionally well populated one, as
can be seen from just a cursory examination of the programming language section of
any major bookshop. Surprisingly, the market in Java network programming texts is
a much less exploited one, featuring very few texts. It is true that the better general-
purpose Java texts provide some guidance on aspects of network programming, but
this almost invariably takes the form of rather superficial coverage, often relegated to
the end of the particular text and offering little more than an outline of the relevant
concepts. Even those few texts that are devoted specifically to network programming
in Java (and one or two are very good indeed) are rather thick tomes that are
probably of greatest use as reference texts. The truth of this assertion appears to be
reinforced by the absence of practical exercises from such texts.
When I began work on the first edition of this work, my declared intention was to
write a more 'streamlined' work that could serve equally as the core text on an
undergraduate module and as the quick, clear, 'no-nonsense' guide required by a busy
IT professional. Numerous examples and associated screenshots were provided, with
the examples 'stripped down' to their bare essentials in order to avoid overwhelming
the reader with too much detail. There is, of course, a level of detail below which it
is impossible to go without omitting some of the essentials and this led to a few
examples running over multiple pages. However, a conscious effort was made to
keep this to a minimum and to provide adequate program comments where this did
occur.
It was gratifying to find that the first edition was well received, but the time has
now come to replace it with an updated version. The changes in this second edition
fall into three categories:
• language changes, largely reflecting the significant changes introduced
by J2SE 5.0 (but also including one or two changes brought in by earlier
versions of Java);
• the updating of support software, particularly that used for Web
applications;
• new material, some related to the changes introduced by J2SE 5.0
(otherwise known as Java 5) and some extending earlier coverage.
A summary of the major elements of these changes is given below.
Language Changes
These mostly affect the example programs and the model solutions provided on the
associated Web site. However, there are occasional, passing references to some of
these new features in the main body of the text where it is considered
appropriate. The main language changes introduced are listed below.
• Replacement of the BufferedReader+InputStreamReader combination with
the single Scanner class, with consequent erradication of the need to use the
vi
An Introduction to Network Programming with Java
type 'wrapper' classes to convert String input into numeric values (a major
improvement on the traditional method for obtaining input).
• Associated with the above, replacement of the BufferedReader+FileReader
combination with Scanner+File and that of the PrintWriter+FileWriter
combination with PrintWriter+File for serial disc file I/O.
• Replacement of the cumbersome addWindowListener(new
WindowAdapter... method for closing down GUI applications with
setDefaultCloseOperation(EXIT_ON_CLOSE). (This had been available
since J2SE 1.3, but had deliberately not been included in the original text
due to the earlier method being the one still used by most people at that
time.)
• The formatting of numeric output (particularly decimal output) via method
printf.
• The inclusion of generics in the declaration of Vectors, with the associated
'auto-boxing' and 'auto-unboxing' of elements.
• Introduction of the 'enhanced for' loop where appropriate.
Updating of Support Software
• Replacement of the JSWDK Web server with Apache Tomcat.
• Replacement of the JavaBean Development Kit (BDK) with the Bean
Builder for the testing of JavaBeans.
• Removal of the section on the now defunct HTMLConverter utility and
updating of the example browsers to Internet Explorer 6 and Firefox 1.5.
New Material
• Coverage of non-blocking I/O (introduced in J2SE 1.4), but retaining
coverage of the more traditional blocking I/O.
• The use of JDBC with the DataSource interface (also introduced in J2SE
1.4), but maintaining coverage of the more traditional DriverManager class
approach. The associated examples are no longer confined to the use of MS
Access, but have been extended to include MySQL. The significant
advantages to large-scale, commercial databases of using DataSource in
preference to DriverManager are made clear to the reader.
• As part of good practice, the above DataSource technique makes use of a
DAO (Data Access Object) to encapsulate access to the database, so that
data manipulation code is separated from business logic.
On the CD-ROM accompanying this text may be found the executable file for
installing J2SE 5.0 onto MS Windows platforms (available via free download from
the Sun site, of course). In addition to this, the CD contains all example code and
several media files (the latter for use with material in the final two chapters). Model
solutions for end-of-chapter exercises are accessible by lecturers and other
authorised individuals from the companion Web site (accessible via
http://homepage.ntlworld.com/jan.graba/javanet.html). Finally, there is a document
entitled Java Environment Installation that provides downloading and installation
剩余432页未读,继续阅读
luojper
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页