31 /** |
31 /** |
32 * Allows different platforms to call different native methods |
32 * Allows different platforms to call different native methods |
33 * for read and write operations. |
33 * for read and write operations. |
34 */ |
34 */ |
35 |
35 |
36 public class SocketDispatcher extends NativeDispatcher { |
36 class SocketDispatcher extends NativeDispatcher { |
37 public SocketDispatcher() { } |
37 SocketDispatcher() { } |
38 |
38 |
39 /** |
39 /** |
40 * Reads up to len bytes from a socket with special handling for "connection |
40 * Reads up to len bytes from a socket with special handling for "connection |
41 * reset". |
41 * reset". |
42 * |
42 * |
43 * @throws sun.net.ConnectionResetException if connection reset is detected |
43 * @throws sun.net.ConnectionResetException if connection reset is detected |
44 * @throws IOException if another I/O error occurs |
44 * @throws IOException if another I/O error occurs |
45 */ |
45 */ |
46 public int read(FileDescriptor fd, long address, int len) throws IOException { |
46 int read(FileDescriptor fd, long address, int len) throws IOException { |
47 return read0(fd, address, len); |
47 return read0(fd, address, len); |
48 } |
48 } |
49 |
49 |
50 /** |
50 /** |
51 * Scattering read from a socket into len buffers with special handling for |
51 * Scattering read from a socket into len buffers with special handling for |
56 */ |
56 */ |
57 long readv(FileDescriptor fd, long address, int len) throws IOException { |
57 long readv(FileDescriptor fd, long address, int len) throws IOException { |
58 return readv0(fd, address, len); |
58 return readv0(fd, address, len); |
59 } |
59 } |
60 |
60 |
61 public int write(FileDescriptor fd, long address, int len) throws IOException { |
61 int write(FileDescriptor fd, long address, int len) throws IOException { |
62 return FileDispatcherImpl.write0(fd, address, len); |
62 return FileDispatcherImpl.write0(fd, address, len); |
63 } |
63 } |
64 |
64 |
65 long writev(FileDescriptor fd, long address, int len) throws IOException { |
65 long writev(FileDescriptor fd, long address, int len) throws IOException { |
66 return FileDispatcherImpl.writev0(fd, address, len); |
66 return FileDispatcherImpl.writev0(fd, address, len); |
67 } |
67 } |
68 |
68 |
69 public void close(FileDescriptor fd) throws IOException { |
69 void close(FileDescriptor fd) throws IOException { |
70 FileDispatcherImpl.close0(fd); |
70 FileDispatcherImpl.close0(fd); |
71 } |
71 } |
72 |
72 |
73 public void preClose(FileDescriptor fd) throws IOException { |
73 void preClose(FileDescriptor fd) throws IOException { |
74 FileDispatcherImpl.preClose0(fd); |
74 FileDispatcherImpl.preClose0(fd); |
75 } |
75 } |
76 |
76 |
77 // -- Native methods -- |
77 // -- Native methods -- |
78 |
78 |