Java NIO

First Edition August 2002
ISBN 978-0-596-00288-6
Seiten 302
EUR34.00, SFR57.90


Weitere Informationen zu diesem Buch

Inhaltsverzeichnis | Index | Probekapitel | Kolophon | Rezensionen |


Index

	
[ Symbols ], [ A ], [ B ], [ C ], [ D ], [ E ], [ F ], [ G ], [ H ], [ I ], [ J ], [ K ], [ L ], [ M ], [ N ], [ O ], [ P ], [ Q ], [ R ], [ S ], [ T ], [ U ], [ V ], [ W ], [ X ]

Symbols[ Top ]
\ (backslash)
      preceding byte-order mark, 193
      in replacement strings, 171, 173
$ (dollar sign), 171
== (equal to operator), 39, 201, 208

A[ Top ]
absolute operations
      ByteBuffer data type methods, 46
      ByteBuffer get( ) and put( ), 19
      FileChannel read( ) and write( ), 70
AbstractInterruptibleChannel class, 53, 235, 260
      (see also InterruptibleChannel interface)
abstractions, in J2SE SDK, 4
AbstractSelectableChannel class, 53, 235, 260
      (see also SelectableChannel class)
AbstractSelectionKey class, 235, 260
AbstractSelector class, 236, 261
accept( ) method, ServerSocketChannel class, 96
accept selectable operation, 128, 131
access mode (see permissions)
advisory file locks, 12, 74
aliases( ) method, Charset class, 200
allocate( ) method, Buffer class, 31
allocateDirect( ) method, ByteBuffer class, 42, 231
AlreadyConnectedException, 246
API reference
      java.nio package, 238-246
      java.nio.channels package, 246-259
      java.nio.channels.spi package, 259-261
      java.nio.charset package, 262-266
      java.nio.charset.spi package, 266
      java.util.regex package, 267-268
appendReplacement( ) method, Matcher class, 174-177
appendTail( ) method, Matcher class, 174-177
array( ) method, Buffer class, 32
arrayOffset( ) method, Buffer class, 32
arrays
      of buffers in scatter/gather, 60-65
      used as backing storage for buffer, 31
asCharBuffer( ) method, ByteBuffer class, 43
ASCII standard character set, 191-192
asDoubleBuffer( ) method, ByteBuffer class, 43
asFloatBuffer( ) method, ByteBuffer class, 43
asIntBuffer( ) method, ByteBuffer class, 43
asLongBuffer( ) method, ByteBuffer class, 42-43
asReadOnlyBuffer( ) method, Buffer class, 34, 44
asShortBuffer( ) method, ByteBuffer class, 43
asynchronous closability, 59, 143
asynchronous connection for SocketChannel, 99-101
asynchronous I/O, 66
AsynchronousCloseException, 59, 75, 247
attach( ) method, SelectionKey class, 129, 132
attachment( ) method, SelectionKey class, 132
availableCharsets( ) method, Charset class, 198
averageBytesPerChar( ) method, CharsetEncoder class, 203
averageCharsPerByte( ) method, CharsetDecoder class, 210

B[ Top ]
backing storage array, 31
backslash (\)
      preceding byte-order mark, 193
      in replacement strings, 171, 173
bidirectional channels, 54
big-endian byte order, 38-40, 193
bind( ) method, DatagramSocket class, 103
bits, number of in bytes, 37
blocking mode, 58, 95, 99
blockingLock( ) method, SelectableChannel class, 95
Buffer class, xi, 15-18, 238
      accessing, 18
      attributes of, 16
      bulk moves with, 27-30
      compacting, 23
      comparing, 25-27
      draining, 20-23
      duplicating, 33-35
      filling, 19, 21-23
      flipping, 20-21
      instantiating, 30-33
      invocation chaining in, 17
      marking, 24
      methods, 17, 238
            allocate( ), 31
            array( ), 32
            arrayOffset( ), 32
            asReadOnlyBuffer( ), 34, 44
            clear( ), 21, 24, 31
            compact( ), 23
            compareTo( ), 26
            duplicate( ), 33, 44
            equals( ), 25-27
            flip( ), 20, 24
            get( ), 18, 28-29
            hasArray( ), 32
            hasRemaining( ), 21
            isDirect( ), 42
            isReadOnly( ), 18, 34, 81
            limit( ), 24
            mark( ), 16, 24
            order( ), 39
            position( ), 24
            put( ), 18, 29
            remaining( ), 21, 28
            reset( ), 16, 24
            rewind( ), 20, 24
            slice( ), 32, 34, 44
            wrap( ), 31
      read-only, 18, 32
      slicing, 34
      subclasses
            (see ByteBuffer class; CharBuffer class; DoubleBuffer class; FloatBuffer class; IntBuffer class; LongBuffer class; ShortBuffer class)
BufferOverflowException, 19, 21, 29-30, 46, 239
buffers, 15-18
      accessing, 18
      bulk moves with, 27-30
      byte order of, 39, 44
      compacting, 23
      comparing, 25-27
      creating, 30-33
      direct, 40, 232
      draining, 20-23
      duplicating, 33-35
      filling, 19, 21-23
      flipping, 20, 21
      marking, 24
      nondirect, 32, 41
      operating system handling of, 5
      permissions, 18, 32
      read-only, 18, 32
      scatter/gather with, 6, 60-65
      slicing, 34
      thread safety of, 21
      view, 33-35, 42-44
      virtual memory and, 7
      (see also Buffer class)
BufferUnderflowException, 19, 21, 28, 46, 239
bugs in JDK 1.4.0, 59
bulk transfers
      between buffers, 27-30
      of file data, 90-92
byte order, 37-40
      buffers, 39
      ByteBuffer class, 39, 46
      charset mark for, 193
      direct byte buffers, 232
      view buffers, 44
byte sex, 38
ByteBuffer class, 15, 35, 239
      accessing, 18
      byte order of, 39, 46, 232
      channel I/O, used in, 40
      data element views of, 45-46
      direct and nondirect, 40, 232
      memory-mapped buffers, 49
      methods, 35, 239
            allocateDirect( ), 42, 231
            asLongBuffer( ), 42
            for data element view buffers, 43
            for data type mutation, 45
      scatter/gather with, 60
      subclasses (see MappedByteBuffer class)
      unsigned data, accessing, 47-48
      view buffers, 40, 42-44
      (see also buffers)
ByteChannel interface, 54, 247
ByteOrder class, 39, 241
bytes
      data type sizes, 37
      as fundamental data unit, 35
      in memory areas of operating system, 40
      number of bits in, 37

C[ Top ]
caching algorithms, 66
cancel( ) method, SelectionKey class, 130, 133
cancelled key set, 130, 133-134
CancelledKeyException, 128, 130, 143, 247
canEncode( ) method
      Charset class, 202
      CharsetEncoder class, 206
CANON_EQ flag, compile( ) method, 159
canonical charset name, 198
capacity attribute, Buffer class, 16
capacity( ) method, Buffer class, 17
capture groups, 169-170
CASE_INSENSITIVE flag, compile( ) method, 158
chaining invocations, 17
Channel interface, 51-53, 247
      classes (see AbstractInterruptibleChannel class; AbstractSelectableChannel class; DatagramChannel class; FileChannel class; SelectableChannel class; ServerSocketChannel class; SocketChannel class)
      methods, 51, 247
            close( ), 51, 58
            isOpen( ), 51, 58
      subinterfaces (see ByteChannel interface; GatheringByteChannel interface; InterruptibleChannel interface; ReadableByteChannel interface; ScatteringByteChannel interface; WritableByteChannel interface)
channel( ) method
      FileLock class, 76
      SelectionKey class, 130
channels, xi, 15, 50-53
      bidirectional, 54
      blocking mode, 58
      ByteBuffers used for I/O with, 40
      closing, 58
      copying data between, 56, 90-92
      customizing, 234-237
      file (see FileChannel class)
      interruptible (see AbstractInterruptible class; InterruptibleChannel interface)
      nonblocking mode, 58
      open state of, 58
      opening, 53, 67
      pipes connecting (see Pipe class)
      readers/writers, interoperating with, 117-118
      returned by Channels utility methods, 118
      scatter/gather with, 60-65, 84-86
      selectable (see AbstractSelectableChannel class; SelectableChannel class)
      socket (see DatagramChannel class; ServerSocketChannel class; SocketChannel class)
      streams, interoperating with, 117-118
      unidirectional, 54
      using, 54-58
      (see also Channel interface)
Channels utility class, 117-118, 248
channel-to-channel transfers, 90-92
character readers, 118
character sets, xii, 190-192
      (see also charsets)
character writers, 118
CharacterCodingException, 209, 262
character-encoding scheme, 191
charAt( ) method, CharSequence interface, 155
CharBuffer class, 15, 241
      CharSequence implemented by, 154
      methods unique to, 29, 32
      (see also buffers)
CharSequence interface, 32, 154-157
      (see also regular expressions)
Charset class, 191, 197-200, 227, 262
      customizing, 216
      instantiating, 198
      methods, 197, 200, 202, 216, 262
            aliases( ), 200
            availableCharsets( ), 198
            canEncode( ), 202
            compareTo( ), 201
            contains( ), 201, 217
            displayName( ), 200
            encode( ), 202
            equals( ), 201
            forName( ), 198
            hashCode( ), 201
            isRegistered( ), 200
            isSupported( ), 198
            name( ), 200
            newEncoder( ), 202
            toString( ), 202
      (see also charsets)
charset( ) method
      CharsetDecoder class, 210
      CharsetEncoder class, 203
Charset Service Provider Interface (SPI), 215-228
CharsetDecoder class, 209-214, 263
      customizing, 217
      methods, 209-211, 218, 263
            averageCharsPerByte( ), 210
            charset( ), 210
            decode( ), 211
            detectedCharset( ), 210
            flush( ), 211
            isAutoDetecting( ), 210
            isCharsetDetected( ), 210
            maxCharsPerByte( ), 210
            replaceWith( ), 212
            reset( ), 210-211
      (see also charsets)
CharsetEncoder class, 203-207, 263
      customizing, 217
      instantiating, 202
      methods, 203, 206, 217, 263
            averageBytesPerChar( ), 203
            canEncode( ), 206
            charset( ), 203
            encode( ), 204-206, 209
            encodeLoop( ), 218
            flush( ), 205
            implReset( ), 218
            isLegalReplacement( ), 207
            malformedInputAction( ), 207
            maxBytesPerChar( ), 204
            onMalformedInput( ), 207
            replacement( ), 207
            replaceWith( ), 207
            reset( ), 204
      (see also charsets)
charsetForName( ) method, CharsetProvider class, 221
CharsetProvider class, 219-228, 266
      (see also charsets)
charsets, 191-195
      byte-order mark, 193
      comparing, 200-202
      customizing, 215-228
      decoding, 209-214
            error handling for, 206
            results of, 208, 211
      default, 192
      encapsulating, 197-200
      encoding, 194-197, 202-207
            error handling for, 206
            results of, 205, 208
      IANA registry for, 193, 200, 215
      naming, 198, 215
charsets( ) method, CharsetProvider class, 221
checkConnect( ) method, security manager, 104
ClassCastException, 26, 201
clear( ) method, Buffer class, 17, 21, 24, 31
client-side sockets, 95
close( ) method
      Channel interface, 51, 58
      Selector class, 127, 137
ClosedByInterruptException, 59, 248
ClosedChannelException, 58, 125, 143, 249
ClosedSelectorException, 127, 249
coded character set, 191
CoderMalfunctionError class, 264
CoderResult class, 208, 264
      encoding results returned by, 205
      methods, 208, 264
      returned by CharsetDecoder, 208, 211
      returned by CharsetEncoder, 208
      (see also charsets)
CodingErrorAction class, 206, 265
      (see also charsets)
COMMENTS flag, compile( ) method, 159
compact( ) method, Buffer class, 23
compareTo( ) method
      Buffer class, 25-26
      Charset class, 201
compile( ) method, Pattern class, 158
concurrency
      FileChannel, 68, 70
      Pattern objects, 159
      selectors, 142
      SocketChannel, 99-101
      (see also file locking; thread safety)
configuration file, for custom charsets, 219
configureBlocking( ) method, SelectableChannel class, 95, 125
connect( ) method
      DatagramChannel class, 104
      Socket class, 99
      SocketChannel class, 99
connect selectable operation, 128, 131
connectionless channels (see DatagramChannel class)
ConnectionPendingException, 249
contains( ) method, Charset class, 201, 217
copy-on-write file mapping, 81, 86-90
CPU systems, single vs. multiple, 143
CPU time (see performance)

D[ Top ]
data element views, 45-46
data integrity
      DatagramChannels, 104, 106
      file modifications, 73
data types
      byte sizes of, 37
      ByteBuffer methods for, 45-46
data, unsigned, accessing from buffers, 47-48
DatagramChannel class, 53, 102-112, 249
      binding, 103
      connecting, 104
      instantiating, 103
      methods, 103, 249
            connect( ), 104
            disconnect( ), 105
            isConnected( ), 105
            read( ), 105
            receive( ), 103
            send( ), 104
            write( ), 105
      peer socket for, 102
      performance of, 106
DatagramSocket class, 94, 102
decode( ) method, CharsetDecoder class, 211
decoding (see charsets, decoding)
demand paging, 9, 10, 83
detectedCharset( ) method, CharsetDecoder class, 210
direct buffers, 40
      sharing with native code, 232
      views of, 33, 45
direct channel transfers, 90-92
Direct Memory Access (DMA), 3
dirty page, 9
disconnect( ) method, DatagramChannel class, 105
displayName( ) method, Charset class, 200
DMA (Direct Memory Access), 3
DocBook DTD, xiv
dollar sign ($), in replacement strings, 171
DOTALL flag, compile( ) method, 159
DoubleBuffer class, 15, 242
      (see also buffers)
duplicate( ) method, Buffer class, 33, 44

E[ Top ]
encode( ) method
      Charset class, 202
      CharsetEncoder class, 204-206, 209
encodeLoop( ) method, CharsetEncoder class, 218
encoding (see charsets, encoding)
end( ) method, Matcher class, 168
endian-ness, 38-40
equal to operator (==)
      for byte order, 39
      for charsets, 201
      for CoderResult objects, 208
equals( ) method
      Buffer class, 25-27
      Charset class, 201
EUC character-encoding scheme, 191
exclusive file locks, 12, 73-80
expression capture groups, 169-170

F[ Top ]
FIFO (First In First Out) queue, buffers as, 24
file channels (see FileChannel class)
file descriptors, 50, 68
file holes, 71
file I/O, 9-13
file locking, xi, 12, 73-80
      (see also concurrency)
file object, instantiating FileChannel with, 67
file position (see position( ) method, FileChannel class)
FileChannel class, xi, 53, 65-68, 250
      accessing files with, 68-73
      bidirectional, 55
      concurrency and, 68, 70
      file locking with, 73-80
      instantiating, 53, 67
      memory-mapped files, 49, 80-90
      methods, 67, 74, 250
            force( ), 69, 73, 84
            lock( ), 75
            map( ), 80-81
            position( ), 68-70
            read( ), 68-70
            size( ), 68, 70
            transferFrom( ), 90-92
            transferTo( ), 90-92
            truncate( ), 69, 72
            tryLock( ), 75-76
            write( ), 68-72
      native I/O services used by, 68
      permissions, 55, 73, 81
      subclasses
            FileLock, 75, 251
            MapMode, 80, 81
      thread safety and, 68
FileInputStream class, instantiating FileChannel with, 53, 67
FileLock class, 75, 251
      (see also FileChannel class)
FileLockInterruptionException, 75, 252
FileOutputStream class, instantiating FileChannel with, 53, 67
files
      bulk transfers of data in, 90-92
      holes in, 71
      memory-mapped, 49, 80-90
      regions of, 12
      synchronizing modifications to, 73, 84
filesystem, 9-12
      blocking behavior on channels, 58
      concurrency and, 68
      data integrity and, 73
      demand paging and, 83
      file holes and, 71, 72
      file locking and, 13, 73
      force( ) method and, 73
find( ) method, Matcher class, 168
finishConnect( ) method, SocketChannel class, 100
First In First Out (FIFO) queue, buffers as, 24
flags( ) method, Pattern class, 160
flip( ) method, Buffer class, 17, 20, 24
FloatBuffer class, 15, 243
      (see also buffers)
flush( ) method
      CharsetDecoder class, 211
      CharsetEncoder class, 205
force( ) method
      FileChannel class, 67, 69, 73, 84
      MappedByteBuffer class, 84
forName( ) method, Charset class, 198

G[ Top ]
GatheringByteChannel interface, 60, 252
      methods, 252
get datatype methods, ByteBuffer class, 45
get( ) method
      Buffer class, 18, 28-29
      ByteBuffer class, 19, 80
getChannel( ) method
      file object, 53, 67
      java.net classes, 94
      Socket class, 99
GetDirectBufferAddress( ) function, 232
GetDirectBufferCapacity( ) function, 232
getEncoding( ) method, InputStreamReader and OutputStreamWriter classes, 198
GetPrimitiveArrayCritical( ) function, 231
greedy quantifiers, 178
grep, object-oriented, 182-188
group( ) method, Matcher class, 170
groupCount( ) method, Matcher class, 170

H[ Top ]
hasArray( ) method, Buffer class, 32
hashCode( ) method, Charset class, 201
hasRemaining( ) method, Buffer class, 17, 21
historical charset name, 198
host byte order, 39

I[ Top ]
IANA (Internet Assigned Names Authority), 193, 200, 215
IllegalArgumentException, 29, 69, 128, 207
IllegalBlockingModeException, 125, 252
IllegalCharsetNameException, 265
IllegalSelectorException, 253
IllegalStateException, 169, 210
implReset( ) method, CharsetEncoder class, 218
IndexOutOfBoundsException, 19, 170
input/output (see I/O)
IntBuffer class, 15, 243
      (see also buffers)
interest set, 128, 130, 132-134
interestOps( ) method, SelectionKey class, 130, 132
Internet Assigned Names Authority (IANA), 193, 200, 215
interrupt( ) method, thread, 59, 75, 137
interrupt status of thread, 59, 137
interrupted( ) method, thread, 59
interruptible channels (see AbstractInterruptible class; InterruptibleChannel interface)
InterruptibleChannel interface, 51, 58, 253
      (see also AbstractInterruptibleChannel class)
InvalidMarkException, 24, 244
invocation chaining, 17
I/O
      Java weaknesses in, ix
      operating system, 4-14
      performance of, 1-3
IOException, 67, 81, 91
isAcceptable( ) method, SelectionKey class, 131
isAutoDetecting( ) method, CharsetDecoder class, 210
isBlocking( ) method, SelectableChannel class, 95
isCharsetDetected( ) method, CharsetDecoder class, 210
isConnectable( ) method, SelectionKey class, 131
isConnected( ) method
      DatagramChannel class, 105
      SocketChannel class, 99
isConnectPending( ) method, SocketChannel class, 100
isDirect( ) method, Buffer class, 42
isError( ) method, CoderResult class, 208
isInterrupted( ) method, 59
isLegalReplacement( ) method, CharsetEncoder class, 207
isLoaded( ) method, MappedByteBuffer class, 84
isMalformed( ) method, CoderResult class, 208
ISO 10646 standard, 191
ISO 8859-1 standard, 191
ISO646-US charset, 192
ISO-8859-1 charset, 192
ISO-LATIN-1 charset, 192
isOpen( ) method
      Channel interface, 51, 58
      Selector class, 127
isOverflow( ) method, CoderResult class, 208
isReadable( ) method, SelectionKey class, 131
isReadOnly( ) method, Buffer class, 17-18, 34, 81
isRegistered( ) method
      Charset class, 200
      SelectableChannel class, 129
isShared( ) method, FileLock class, 76
isSupported( ) method, Charset class, 198
isUnderflow( ) method, CoderResult class, 208
isUnmappable( ) method, CoderResult class, 208
isValid( ) method
      FileLock class, 76
      SelectionKey class, 130
isWritable( ) method, SelectionKey class, 131
Iterator class, 142

J[ Top ]
J2SE SDK (JDK)
      known bugs in, 59
      new features of, 4
      software requirements, xiii
JAR (Java Archive) file, 219
Jausoft, OpenGL For Java, 232
Java 2 Standard Edition Software Development Kit (see J2SE SDK)
Java Archive (JAR) file, 219
Java Community Process (JCP), x
Java Development Kit (see J2SE SDK)
Java Native Interface (JNI), 4, 231-233
Java New I/O (see Java NIO)
Java NIO
      development history of, x
      features of, 4
      interaction with JNI, 231-233
Java Specification Request 51 (JSR 51), x, xii, 151
Java Virtual Machine (see JVM)
java.io package, xi, xii, 3, 117
java.net package, 94
java.nio package, ix, 4
      API reference for, 238-246
      (see also buffers)
java.nio.channels package, 53
      API reference for, 246-259
      (see also channels)
java.nio.channels.spi package, 4, 53, 234-237
      API reference for, 259-261
java.nio.charset package, xii
      API reference for, 262-266
      (see also charsets)
java.nio.charset.spi package, 215-228
      API reference for, 266
java.nio.charset.spi.CharsetProvider file, 219
java.util.regex package, xii
      API reference for, 267-268
      (see also regular expressions)
JCanyon application (Sun), 233
JCP (Java Community Process), x
JDirect package, 4
JDK (see J2SE SDK)
JIS X0201 standard, 191
JNI (Java Native Interface), 4, 231-233
JSR 51 (Java Specification Request 51), x, xii, 151
JVM heap
      direct buffers bypassing, 41, 82
      JNI functions using, 231
      MappedByteBuffer not using, 82
      memory-mapping not using, 80
JVM (Java Virtual Machine), ix
      charset requirements for, 192
      performance of, 2, 41

K[ Top ]
kernel space, 6
key sets, 133
      cancelled key set, 130, 133-134
      concurrency and, 142
      registered key set, 133-134, 142
      selected key set, 133-134, 137-143
      thread-safety of, 142
keyFor( ) method, SelectableChannel class, 129
keys( ) method, Selector class, 133

L[ Top ]
length( ) method
      CharSequence interface, 155
      CoderResult class, 208
lexicographic comparison, 26
limit attribute, Buffer class, 16, 20
limit( ) method, Buffer class, 17, 24
little-endian byte order, 38-40, 193
load( ) method, MappedByteBuffer class, 83
lock( ) method, FileChannel class, 67, 75
LongBuffer class, 15, 244
      (see also buffers)
lookingAt( ) method, Matcher class, 168

M[ Top ]
malformed input condition, 205-206, 208
malformedForLength( ) method, CoderResult class, 209
malformedInputAction( ) method, CharsetEncoder class, 207
MalformedInputException, 265
mandatory file locks, 12
map( ) method, FileChannel class, 67, 80-81
MapMode class, 80, 81
MappedByteBuffer class, 15, 49, 80-90, 245
      methods, 83, 245
            force( ), 84
            isLoaded( ), 84
            load( ), 83
      unmapping, 82
      (see also buffers; ByteBuffer class)
mark attribute, Buffer class, 16, 24
mark( ) method, Buffer class, 16-17, 24
Matcher class, 164-177, 267
      instantiating, 165
      methods, 164, 169, 267
            appendReplacement( ), 174-177
            appendTail( ), 174-177
            end( ), 168
            find( ), 168
            group( ), 170
            groupCount( ), 170
            lookingAt( ), 168
            matches( ), 168
            replaceAll( ), 170-174
            replaceFirst( ), 170-174
            reset( ), 165-168
            start( ), 168
      (see also regular expressions)
matcher( ) method, Pattern class, 161
matches( ) method
      Matcher class, 168
      Pattern class, 157
      String class, 178
maxBytesPerChar( ) method, CharsetEncoder class, 204
maxCharsPerByte( ) method, CharsetDecoder class, 210
memory
      JVM heap
            direct buffers bypassing, 41, 82
            JNI functions using, 231
            MappedByteBuffer not using, 82
            memory-mapping not using, 80
      operating system
            areas, 40
            encapsulating in Java buffer, 231-233
            pages, 7
      physical, 7-9
      virtual, 7-9
            memory-mapped buffers and, 83
            memory-mapped files and, 80
            paging, 8
Memory Management Unit (MMU), 9
memory-mapped files, xi, 11, 49, 80-90
      and scatter/gather, 83-86
memory-mapped I/O, 11
MemoryMappedBuffer class, 82
Merlin release, ix
metadata, synchronizing for files, 73, 84
META-INF directory, 219
metaphors (see abstractions)
MMU (Memory Management Unit), 9
MULTILINE flag, compile( ) method, 159
multiple threads (see threads)
multiplexed I/O, 14, 120
      (see also readiness selection)

N[ Top ]
name( ) method, Charset class, 200
nativeOrder( ) method, 39
network byte order, 39
network connections, point-to-point ordered, 98
New I/O (see Java NIO)
newChannel( ) method, Channels utility class, 117
NewDirectByteBuffer( ) function, 231
newEncoder( ) method, Charset class, 202
newInputStream( ) method, Channels utility class, 117
newOutputStream( ) method, Channels utility class, 117
newReader( ) method, Channels utility class, 118
newWriter( ) method, Channels utility class, 118
NIO (see Java NIO)
NoConnectionPendingException, 100, 253
nonblocking mode, 58
      ServerSocketChannel using, 97
      socket channels capable of, 92, 94
      SocketChannel connection, 99
      streams using, 13
nondirect buffers, 32, 41
NonReadableChannelException, 81, 253
NonWritableChannelException, 55, 81, 254
NotYetBoundException, 254
NotYetConnectedException, 99, 106, 254

O[ Top ]
object-oriented file grep, 182-188
onMalformedInput( ) method, CharsetEncoder class, 207
open( ) method
      DatagramChannel class, 103
      Pipe class, 114
      Selector class, 127
      ServerSocketChannel class, 96
      SocketChannel class, 99
OpenGL For Java (Jausoft), 232
openSelector( ) method, SelectorProvider class, 127
operating system
      areas, 40
      asynchronous I/O and, 66
      blocking behavior on channels, 58
      byte-oriented nature of, 35, 53, 192
      caching and prefetch algorithms, 66
      channels, relationship to, 50
      channel-to-channels transfers by, 91
      concurrency and, 68
      copy-on-write feature, 82
operating system
      data integrity and, 73
      default charset deteremined by, 192
      demand paging and, 83
      file-locking features of, 73
      FileChannel I/O methods corresponding to, 68
      interrupted I/O operations, 59
      I/O, 3-14
      memory management by, 84
      native vectored I/O and, 60
      pages, 7-10
      pipes used on, 112
      readiness selection performed by, 120, 122, 134, 144
      regular expressions and, 153
      scatter/gather and, 62
      selectable-channels SPI and, 234
      time service provided by, 106
operation interest set, 128, 130, 132-134
operation ready set, 130, 133-135, 137
order( ) method, Buffer class, 39
overflow condition, 205, 208
OverlappingFileLockException, 254
overlaps( ) method, FileLock class, 76

P[ Top ]
packet-oriented channels (see DatagramChannel class)
page alignment, 7
page fault, 9
page validation, 9, 83
pagein operation, 9
pageout operation, 9
pages
      dirty, 9
      filesystem, 10
      memory, 7
      stolen, 9
paging area, 8
paging
      demand, 9-10, 83
      virtual memory, 8
Pattern class, 157-161, 267
      instantiating, 158
      methods, 157, 160, 267
            compile( ), 158
            flags( ), 160
            matcher( ), 161
            matches( ), 157
            pattern( ), 160
            split( ), 160-164
      (see also regular expressions)
pattern matching (see regular expressions)
pattern( ) method, Pattern class, 160
PatternSyntaxException, 158, 268
peer sockets
      for DatagramChannel, 102
      for ServerSocketChannel, 96
      for SocketChannel object, 99
      socket channels creating, 94
performance
      bulk transfers of file data, 90
      DatagramChannels, 106
      direct buffers, 41
      exclusive locks, 74
      I/O, 1-3
      JVM, 2, 41
      memory-mapped files, 80
      metadata updates, 73
      native byte order, 40
      nondirect buffers, 41
      selectable-channel SPI, 53
      single threads managing multiple selectable channels, 143
      stream-oriented protocols, 106
Perl, regular expressions in, 152
permissions
      buffer, 18, 32
      file, 55, 73
      file mappings, 81
      file-locking requirements for, 75
phantom references, 82
physical memory
      memory paging and, 8
      MMU mapping from virtual memory, 9
      virtual addresses for, 7
Pipe class, 112-117, 255
      creating with SelectorProvider, 235
      instantiating, 114
      methods, 114, 255
            open( ), 114
            sink( ), 114
            source( ), 114
      SinkChannel object created by, 114
      SourceChannel object created by, 114
platform (see operating system)
point-to-point ordered network connections, 98
position attribute, Buffer class, 18-19
position( ) method
      Buffer class, 17, 24
      FileChannel class, 67-70
POSIX system calls, similar to FileChannel API, 68
possessive quantifiers, 178
prefetch algorithms, 66
private mode for file mappings, 81, 86-90
provider( ) method
      Selector class, 127
      SelectorProvider class, 235
put datatype methods, ByteBuffer class, 45
put( ) method
      Buffer class, 18, 29
      ByteBuffer class, 19, 80
      CharBuffer class, 30

Q[ Top ]
quantifiers, 178

R[ Top ]
RandomAccessFile class
      instantiating FileChannel with, 53, 67
      performance of, 3
      similarity to FileChannel, 68
raw memory, allocating, 231-233
read( ) method
      channel, 83
      DatagramChannel class, 105
      FileChannel class, 67-70
      RandomAccessFile class, 3
      ReadableByteChannel interface, 54
      ScatteringByteChannel interface, 60-65
read selectable operation, 128, 131
read( ) system call, 5
ReadableByteChannel interface, 53-54, 255
readers, character, 118
readiness selection, xii, 120-122
      checking readiness state, 130, 134
      nonblocking I/O and, 95
      operations to test for, 128, 131
      stream I/O and, 14
      (see also selectors)
read-only buffers, 18, 32
read-only file mappings, 81
ReadOnlyBufferException, 32, 34, 245
ready set, 130, 133-135, 137
readyOps( ) method, SelectionKey class, 130
receive( ) method, DatagramChannel class, 103
regions, file, 12
register( ) method, SelectableChannel class, 123-124, 128, 132
registered key set, 133-134, 142
regular expressions, xii, 151-154
      capture groups, 169-170
      character sequence to match
            encapsulating, 154-157
            modifying, 170-177
      compared to Perl capabilities, 152
      encapsulating, 157-164
      file grep implemented with, 182-188
      history of, 153
      matching against character sequence, 164-170
      other packages for, 154
      splitting strings with, 161-164
      String class methods for, 177
      syntax for, 178-182
relative operations
      ByteBuffer data type methods, 46
      get( ) and put( ), 19
release( ) method, FileLock class, 76
ReleasePrimitiveArrayCritical( ) function, 231
remaining( ) method, Buffer class, 17, 21, 28
remove( ) method, Iterator class, 142
replaceAll( ) method
      Matcher class, 170-174
      String class, 178
replaceFirst( ) method
      Matcher class, 170-174
      String class, 178
replacement( ) method, CharsetEncoder class, 207
replaceWith( ) method
      CharsetDecoder class, 212
      CharsetEncoder class, 207
reset( ) method
      Buffer class, 16-17, 24
      CharsetDecoder class, 210-211
      CharsetEncoder class, 204
      Matcher class, 165-168
rewind( ) method, Buffer class, 17, 20, 24
RFC 2278, 191, 215
RFC 2279, 191, 193

S[ Top ]
scalability
      nonblocking mode and, 94
      pipes and, 115
scalability
      readiness selection and, 121
      selectors and, 143-149
      socket channels and, 92
      traditional Java I/O and, x
scatter/gather, 6, 60-65, 83-86
ScatteringByteChannel interface, 60, 256
sectors, 9
security manager, for CharsetProvider, 221
SecurityException, 105, 221
segmentation fault, 9
select( ) method, Selector class, 127, 130, 134-135, 141
selectable channels (see AbstractSelectableChannel class; SelectableChannel class)
selectable operations, 128, 131
SelectableChannel class, 94, 123-125, 256
      closing, 130, 143
      deregistering, 128, 135
      methods, 123, 127, 256
            blockingLock( ), 95
            configureBlocking( ), 95, 125
            isBlocking( ), 95
            isRegistered( ), 129
            keyFor( ), 129
            register( ), 123-124, 128, 132
            validOps( ), 128
      returned from SelectionKey, 130
      (see also AbstractSelectableChannel class; selectors)
Selectable-Channels SPI, 234-237
selected key set, 133-134, 137-142, 143
selectedKeys( ) method, Selector class, 133, 143
SelectionKey class, 123, 129-132, 256
      attachment of object to, 131
      cancelling, 128, 130, 135, 143
      methods, 126, 129, 131, 256
            attach( ), 129, 132
            attachment( ), 132
            cancel( ), 130, 133
            channel( ), 130
            interestOps( ), 130, 132
            isAcceptable( ), 131
            isConnectable( ), 131
            isReadable( ), 131
            isValid( ), 130
            isWritable( ), 131
            readyOps( ), 130
      operation interest set, 128, 130, 132-134
      operation ready set, 130, 133-135, 137
      returning from SelectableChannel, 129
      (see also selectors)
selectNow( ) method, Selector class, 136
Selector class, xii, 123, 125, 135, 257
      cancelled key set, 130, 133-134
      closing, 130
      methods, 125, 127, 133, 135-136, 257
            close( ), 127, 137
            isOpen( ), 127
            keys( ), 133
            open( ), 127
            provider( ), 127
            select( ), 127, 130, 134-135, 141
            selectedKeys( ), 133, 143
            selectNow( ), 136
            wakeup( ), 136
      registered key set, 133-134, 142
      returned from SelectionKey, 130
      selected key set, 133, 134, 137-142, 143
      Set objects in, 142
      (see also selectors)
SelectorProvider class, 127, 234, 261
selectors, xii, 120-122
      asynchronous closability with, 143
      cancelling, 130, 135
      concurrency and, 142
      customizing, 234-237
      key sets for, 133, 137-142
      operation interest set, 128, 130, 132-134
      operation ready set, 130, 133-135, 137
      registering, 124
      scalability of, 143-149
      selection process, 134-137
      setting up, 126-129
      threads and, 59, 120, 132
      using with pipes, 114
      (see also SelectableChannel class; SelectionKey class; Selector class)
send( ) method, DatagramChannel class, 104
server-side sockets, 95
ServerSocket class, 94, 96
ServerSocketChannel class, 53, 92, 96-98, 257
      binding, 96
      instantiating, 96
      methods, 96, 257
      peer socket for, 96
Service Provider Interface (see SPI)
Set objects, inside Selector, 142
shared file locks, 12, 73-80
ShortBuffer class, 15, 246
      (see also buffers)
sink( ) method, Pipe class, 114
SinkChannel class, 114
      (see also Pipe class)
size( ) method, FileChannel class, 67-68, 70
slice( ) method, Buffer class, 32, 34, 44
socket channels, xi, 92-94
      bidirectional, 55
      creating with SelectorProvider, 235
      file data transfers to and from, 90
      nonblocking mode, 92, 94
      readiness selection enabled with, 58
      threads and, 92, 102
      (see also DatagramChannel class; ServerSocketChannel class; SocketChannel class)
Socket class, 94, 99
socket( ) method
      DatagramChannel class, 103
      ServerSocketChannel class, 96
      socket channels, 94
      SocketChannel class, 99
SocketAddress class, 105
SocketChannel class, 53, 98-102, 258
      connection, establishing, 99-101
      methods, 98, 258
      peer socket for, 99
SocketImpl class, 96
source( ) method, Pipe class, 114
SourceChannel class, 114
      (see also Pipe class)
SPI (Service Provider Interface)
      for charsets, 215-228
      for selectable channels, 234-237
split( ) method
      Pattern class, 160-164
      String class, 178
start( ) method, Matcher class, 168
stolen page, 9
stream-based I/O, 3, 13
String class
      CharSequence implemented by, 154
      methods for regular expressions, 177
StringBuffer class, CharSequence implemented by, 154
strings
      bulk moves to buffers, 30
      pattern matching with (see regular expressions)
      splitting, 161-164
subSequence( ) method, CharSequence interface, 155
swapping (see virtual memory paging)
synchronization
      file modifications, 73, 84
      Selector object, 142
synchronized keyword, 95
system call, 6
system memory, allocating, 231-233

T[ Top ]
TANSTAAFL principle, 3
TCP/IP connections, similarity to Socket and SocketChannel, 98
thrashing, 9
thread safety
      buffers, 21
      charset decoders, 209
      charset encoders, 204
      Charset methods, 198
      FileChannel objects, 68
      FileLock objects, 76
      Matcher objects, 165
      Pattern objects, 159
      SelectionKey objects, 132
      Selector objects, 142
      socket channels, 102
      (see also concurrency)
threads
      interrupt status of, 59, 137
      interrupted, 58-59, 75, 137
      multiple
            draining buffers with, 21
            file locking and, 74, 76
            key sets accessed by, 142
            Pattern objects used by, 159
            pipes and, 114-115
            selectable channels and, 144
            socket channels and, 92, 102
      nonblocking channels and, 58
      single
            selectable channels and, 143
            selectors and, 120, 132
throwException( ) method, CoderResult class, 209
time servers, 106-112
toString( ) method
      ByteOrder class, 39
      CharSequence interface, 155
      Charset class, 202
transcoding (see charsets, decoding; charsets, encoding)
transferFrom( ) method, FileChannel class, 67, 90-92
transferTo( ) method, FileChannel class, 67, 90-92
trap (see system call)
truncate( ) method, FileChannel class, 67, 69, 72
tryLock( ) method, FileChannel class, 67, 75-76

U[ Top ]
UDP/IP connectionless protocol, similarity to DatagramChannel, 102
\uFFFE byte-order mark, 193
\uFEFF byte-order mark, 193
underflow condition, 205, 208
Unicode (ISO 10646-1) standard, 19, 191
Unicode Regular Expression Guidelines report, 178
UNICODE_CASE flag, compile( ) method, 159
unidirectional channels, 54
Unix, regular expressions in, 152
UNIX_LINES flag, compile( ) method, 158
unmappable character condition, 205-206, 208
UnmappableCharacterException, 266
unmappableForLength( ) method, CoderResult class, 209
UnresolvedAddressException, 259
unsigned data, accessing from buffers, 47-48
UnsupportedAddressTypeException, 259
UnsupportedCharsetException, 266
UnsupportedOperationException, 32, 133, 142, 202, 208, 210
US-ASCII standard character set, 191-192
user space, 6
UTF-8 character encoding scheme, 191
UTF-8 charset, 193
UTF-16 charset, 193
UTF-16BE charset, 193
UTF-16LE charset, 193

V[ Top ]
validation of page, 9
validOps( ) method
      SelectableChannel class, 128
      ServerSocketChannel class, 98
vectored I/O (see scatter/gather)
version requirements, ix, xiii
view buffers, 33-35
      byte order of, 44
      of ByteBuffer objects, 40, 42-44
      of direct byte buffers, 45
virtual machine (see JVM)
virtual memory, 7-9
      memory-mapped buffers and, 83
      memory-mapped files and, 80
      MMU mapping to physical memory, 9
      paging, 8

W[ Top ]
wakeup( ) method, Selector class, 136
wrap( ) method
      Buffer class, 31
      CharBuffer class, 32
writable file mappings, 81
WritableByteChannel interface, 53-54, 259
write( ) method
      channel, 83
      DatagramChannel class, 105
      FileChannel class, 67-72
      GatheringByteChannel interface, 60-65
      RandomAccessFile class, 3
      WritableByteChannel interface, 54
write selectable operation, 128, 131
writers, character, 118

X[ Top ]
X-ROT13 charset, 228
XXE Java editor, xiv

	

Zurück zu Java NIO


Themen

Buchreihen

Special Interest

International Sites

O'Reilly China O'Reilly France O'Reilly USA O'Reilly Japan O'Reilly Taiwan