Java I/O Tips and Techniques for Putting I/O to Work 2nd Edition by Elliotte Rusty Harold – Ebook PDF Instant Download/Delivery. 1449391540, 9781449391546
Full download Java I/O Tips and Techniques for Putting I/O to Work 2nd Edition after payment
Product details:
ISBN 10: 1449391540
ISBN 13: 9781449391546
Author: Elliotte Rusty Harold
All of Java’s Input/Output (I/O) facilities are based on streams, which provide simple ways to read and write data of different types. Java provides many different kinds of streams, each with its own application. The universe of streams is divided into four largecategories: input streams and output streams, for reading and writing binary data; and readers and writers, for reading and writing textual (character) data. You’re almost certainly familiar with the basic kinds of streams–but did you know that there’s a CipherInputStream for reading encrypted data? And a ZipOutputStream for automaticallycompressing data? Do you know how to use buffered streams effectively to make your I/O operations more efficient? Java I/O, 2nd Edition has been updated for Java 5.0 APIs and tells you all you ever need to know about streams–and probably more. A discussion of I/O wouldn’t be complete without treatment of character sets and formatting. Java supports the Unicode standard, which provides definitions for the character sets of most written languages. Consequently, Java is the first programming language that lets you do I/O in virtually any language. Java also provides a sophisticated model for formatting textual and numeric data. Java I/O, 2nd Edition shows you how to control number formatting, use characters aside from the standard (but outdated) ASCII character set, and get a head start on writing truly multilingual software. Java I/O, 2nd Edition includes: Coverage of all I/O classes and related classes In-depth coverage of Java’s number formatting facilities and its support for international character sets.
Java I/O Tips and Techniques for Putting I/O to Work 2nd Table of contents:
Part I
Introducing I/O
What Is a Stream?
Where Do Streams Come From?
The Stream Classes
Numeric Data
Integer Data
Conversions and Casts
Character Data
ASCII
Latin-1
Unicode
Other Encodings
The char Data Type
Readers and Writers
Buffers and Channels
The Ubiquitous IOException
The Console: System.out, System.in, and System.err
System.out
System.err
System.in
Redirecting System.out, System.in, and System.err
The Console Class // Java 6
Security Checks on I/O
Output Streams
Writing Bytes to Output Streams
Writing Arrays of Bytes
Closing Output Streams
The Closeable Interface
Flushing Output Streams
The Flushable Interface
Subclassing OutputStream
A Graphical User Interface for Output Streams
Input Streams
The read( ) Method
Reading Chunks of Data from a Stream
Counting the Available Bytes
Skipping Bytes
Closing Input Streams
Marking and Resetting
Subclassing InputStream
An Efficient Stream Copier
Part II
File Streams
Reading Files
Writing Files
File Viewer, Part 1
Network Streams
URLs
URL Connections
Reading Data from URL Connections
Writing Data on URL Connections
Sockets
Server Sockets
URLViewer
Part III
Filter Streams
The Filter Stream Classes
The Filter Stream Subclasses
Buffered Streams
BufferedInputStream Details
BufferedOutputStream Details
PushbackInputStream
ProgressMonitorInputStream
Multitarget Output Streams
File Viewer, Part 2
Print Streams
Print Versus Write
Line Breaks
Error Handling
printf( )
Formatter
Constructors
Character Sets
Locales
Error Handling
Format Specifiers
Integer conversions
Floating-point conversions
Date and time conversions
Character conversions
Boolean conversions
General conversions
Format Modifiers
Argument index
Flags
Width
Precision
Formattable
Data Streams
The Data Stream Classes
The DataInput and DataOutput Interfaces
Constructors
Integers
Integer Formats
The Char Format
Writing Integers
Reading Integers
Floating-Point Numbers
Writing Floating-Point Numbers
Reading Floating-Point Numbers
Booleans
Byte Arrays
Determining the Number of Bytes Written
Skipping Bytes
Strings and chars
Writing Text
Reading Text
The Deprecated readLine( ) Method
Little-Endian Numbers
Thread Safety
File Viewer, Part 3
Streams in Memory
Sequence Input Streams
Byte Array Streams
Byte Array Input Streams
Byte Array Output Streams
Communicating Between Threads Using Piped Streams
Compressing Streams
Inflaters and Deflaters
Deflating Data
Constructing deflaters
Choose a strategy
Set the compression level
Set the dictionary
Set the input
Deflate the data repeatedly until needsInput( ) returns true
Finish the deflation
Reset the deflater and start over
An example
Checking the state of a deflater
Inflating Data
Constructing inflaters
Set the input
Check whether a preset dictionary was used
Set the dictionary
Inflate the data
Reset the inflater
An example
Checking the state of an inflater
Compressing and Decompressing Streams
The DeflaterOutputStream Class
The InflaterInputStream Class
The GZIPOutputStream Class
The GZIPInputStream Class
Expanding Output Streams and Compressing Input Streams
Zip Files
Zip Entries
The ZipOutputStream Class
Constructing and initializing the ZipOutputStream
Set the comment for the zip file
Set the default compression level and method
Construct a ZipEntry object and put it in the archive
Write the entry’s data onto the output stream
Close the zip entry
Finish the zip output stream
Close the zip output stream
An example
The ZipInputStream Class
Construct a ZipInputStream
Open the next zip entry
Reading from a ZipInputStream
Close the zip entry
Close the ZipInputStream
An example
Checksums
Checked Streams
File Viewer, Part 4
JAR Archives
Meta-Information: Manifest Files and Signatures
The jar Tool
The java.util.jar Package
JarFile
JarEntry
Attributes
Manifest
JarInputStream
JarOutputStream
JarURLConnection
Pack200
Reading Resources from JAR Files
Cryptographic Streams
Hash Functions
Requirements for Hash Functions
The MessageDigest Class
Calculating Message Digests
Creating Message Digests
Feeding Data to the Digest
Finishing the Digest
Reusing Digests
Comparing Digests
Accessor Methods
Digest Streams
DigestInputStream
DigestOutputStream
Encryption Basics
Keys
Secret Key Versus Public Key Algorithms
Block Versus Stream Ciphers
Key Management
The Cipher Class
init( )
Mode
Key
Algorithm parameters
Source of randomness
update( )
doFinal( )
Accessor Methods
Cipher Streams
CipherInputStream
CipherOutputStream
File Viewer, Part 5
Object Serialization
Reading and Writing Objects
Object Streams
How Object Serialization Works
Performance
The Serializable Interface
Classes That Implement Serializable but Aren’t
Problem 1: References to nonserializable objects
Problem 2: Missing a no-argument constructor in superclass
Problem 3: Deliberate throwing of NotSerializableException
Locating the offending object
Making nonserializable fields transient
Versioning
Compatible and Incompatible Changes
SUIDs
Customizing the Serialization Format
The readObject( ) and writeObject( ) Methods
The defaultWriteObject() and defaultReadObject( ) Methods
The writeReplace( ) Method
The readResolve( ) Method
serialPersistentFields
Preventing Serialization
Externalizable
Resolving Classes
Resolving Objects
Validation
Sealed Objects
JavaDoc
@serial
@serialData
@serialField
Part IV
Buffers
Copying Files with Buffers
Creating Buffers
Buffer Layout
Limit
Bulk Put and Get
Absolute Put and Get
Mark and Reset
Compaction
Duplication
Slicing
Typed Data
View Buffers
Put Type Methods
Byte Order
Read-Only Buffers
CharBuffers
Memory-Mapped I/O
Creating Mapped Byte Buffers
MappedByteBuffer Methods
Channels
The Channel Interfaces
Channel
ReadableByteChannel and WritableByteChannel
ByteChannel
Exceptions
Gathering and Scattering Channels
File Channels
Transferring Data
Random Access
Threading and Locking
FileLock
Flushing
Converting Between Streams and Channels
Converting Channels to Streams
Converting Streams to Channels
Converting Channels to Readers and Writers
Socket Channels
Server Socket Channels
Datagram Channels
Connecting
Reading
Writing
Nonblocking I/O
Nonblocking I/O
Selectable Channels
Selectors
Selection Keys
Getters
Attachments
Canceling
Pipe Channels
Part V
Working with Files
Understanding Files
Filenames
File Attributes
Filename Extensions and File Types
Directories and Paths
Paths and Separators
Relative versus Absolute Paths
Absolute paths
Relative paths
The File Class
Constructing File Objects
Listing the Roots
Listing Information about a File
Does the file exist? Is it a normal file? Is it a directory?
Filename and path
Absolute paths
Canonical paths
Parents
File attributes
An example
Manipulating Files
Creating files
Moving and renaming files
Deleting files
Changing file attributes
Temporary Files
Checking for Free Space/Java 6
Directories
Creating directories
Listing directories
The listFiles( ) methods
File URLs
Filename Filters
File Filters
File Descriptors
Random-Access Files
General Techniques for Cross-Platform File Access Code
File Dialogs and Choosers
File Dialogs
JFileChooser
Constructing File Choosers
Displaying File Choosers
Getting the User’s Selection
Manipulating the JFileChooser
Custom Dialogs
Filters
Selecting Directories
Multiple Selections
Hidden Files
File Views
FileSystem Views
Handling Events
Action events
Property change events
Accessory
File Viewer, Part 6
Part VI
Character Sets and Unicode
The Unicode Character Set
UTF-16
UTF-8
Other Encodings
Converting Between Byte Arrays and Strings
The String Class
The Charset Class
Retrieving Charset objects
Character set info
Encoding and decoding
CharsetEncoder and CharsetDecoder
Encoding
Decoding
Error handling
Measurement
Encodability
Readers and Writers
The java.io.Writer Class
The OutputStreamWriter Class
The java.io.Reader Class
The InputStreamReader Class
Encoding Heuristics
Character Array Readers and Writers
The CharArrayWriter Class
The CharArrayReader Class
String Readers and Writers
String Writers
String Readers
Reading and Writing Files
FileWriter
FileReader
Buffered Readers and Writers
Buffering Writes
Buffering Reads
Line Numbering
Print Writers
Piped Readers and Writers
Filtered Readers and Writers
The FilterReader Class
The FilterWriter Class
PushbackReader
File Viewer Finis
Formatted I/O with java.text
The Old Way
Choosing a Locale
Number Formats
Formatting Numbers
Specifying Precision
Grouping
Currency Formats
Percent Formats
Specifying Width with FieldPosition
Parsing Input
Decimal Formats
Decimal Format Patterns
DecimalFormatSymbols
Constructing Decimal Formats with Patterns and Symbols
Part VII
The Java Communications API
The Architecture of the Java Communications API
Identifying Ports
Finding the Ports
Getting Information about a Port
Opening Ports
Communicating with a Device on a Port
Communicating with a Port
Port Properties
Serial Ports
Control Functions
Flow Control
Control Wires
DTR
RTS
CTS
DSR
RI
CD
Serial Port Events
SerialPortEventListener
SerialPortEvent
Parallel Ports
Parallel Port Modes
Controlling the Parallel Port
Checking the State of the Port
Parallel Port Events
Parallel Port Event Listeners
ParallelPortEvent
USB
USB Architecture
Finding Devices
Controlling Devices
Describing Devices
UsbDevice
UsbDeviceDescriptor
USB Configurations
UsbConfigurationDescriptor
UsbInterface
Settings
Claiming
UsbInterfaceDescriptor
UsbEndpoints
Pipes
IRPs
Temperature Sensor Example
Hot Plugging
The J2ME Generic Connection Framework
The Generic Connection Framework
The Connector Class
ContentConnection
Files
File attributes
Listing directories
Filesystem Listeners
HTTP
Getter Methods
Configuring the HTTP Request Header
Reading the HTTP Response Header
Serial I/O
Sockets
Getters
Socket Options
Server Sockets
Datagrams
Datagram URLs
Bluetooth
The Bluetooth Protocol
The Java Bluetooth API
UUIDs
The Bluetooth Control Center
Initialization
The Local Device
Properties
Device Class
Discoverability
Discovering Devices
Remote Devices
Service Records
The DataElement Class
Finding Service Records
The ServiceRecord Interface
Talking to Devices
RFCOMM Clients
L2CAP Devices
People also search for Java I/O Tips and Techniques for Putting I/O to Work 2nd:
java i/o exception
java i/o tutorial
java i/o api
java i/o package
java i/o and files