keycloak-federation
公開メンバ関数 | 静的公開変数類 | 変数 | 非公開メンバ関数 | 非公開変数類 | 全メンバ一覧
cx.ath.matthew.unix.USInputStream クラス
cx.ath.matthew.unix.USInputStream の継承関係図
Inheritance graph
cx.ath.matthew.unix.USInputStream 連携図
Collaboration graph

公開メンバ関数

 USInputStream (int sock, UnixSocket us)
 
void close () throws IOException
 
boolean markSupported ()
 
int read () throws IOException
 
int read (byte[] b, int off, int len) throws IOException
 
boolean isClosed ()
 
UnixSocket getSocket ()
 
void setBlocking (boolean enable)
 
void setSoTimeout (int timeout)
 

静的公開変数類

static final int MSG_DONTWAIT = 0x40
 

変数

boolean closed = false
 

非公開メンバ関数

native int native_recv (int sock, byte[] b, int off, int len, int flags, int timeout) throws IOException
 

非公開変数類

int sock
 
byte [] onebuf = new byte[1]
 
UnixSocket us
 
boolean blocking = true
 
int flags = 0
 
int timeout = 0
 

詳解

構築子と解体子

◆ USInputStream()

cx.ath.matthew.unix.USInputStream.USInputStream ( int  sock,
UnixSocket  us 
)
inline
45  {
46  this.sock = sock;
47  this.us = us;
48  }
UnixSocket us
Definition: USInputStream.java:40
int sock
Definition: USInputStream.java:37

関数詳解

◆ close()

void cx.ath.matthew.unix.USInputStream.close ( ) throws IOException
inline
50  {
51  closed = true;
52  us.close();
53  }
synchronized void close()
Definition: UnixSocket.java:135
boolean closed
Definition: USInputStream.java:38
UnixSocket us
Definition: USInputStream.java:40

◆ getSocket()

UnixSocket cx.ath.matthew.unix.USInputStream.getSocket ( )
inline
83  {
84  return us;
85  }
UnixSocket us
Definition: USInputStream.java:40

◆ isClosed()

boolean cx.ath.matthew.unix.USInputStream.isClosed ( )
inline
79  {
80  return closed;
81  }
boolean closed
Definition: USInputStream.java:38

◆ markSupported()

boolean cx.ath.matthew.unix.USInputStream.markSupported ( )
inline
55  {
56  return false;
57  }

◆ native_recv()

native int cx.ath.matthew.unix.USInputStream.native_recv ( int  sock,
byte []  b,
int  off,
int  len,
int  flags,
int  timeout 
) throws IOException
private

◆ read() [1/2]

int cx.ath.matthew.unix.USInputStream.read ( ) throws IOException
inline
59  {
60  int rv = 0;
61  while (0 >= rv) rv = read(onebuf);
62  if (-1 == rv) return -1;
63  return 0 > onebuf[0] ? -onebuf[0] : onebuf[0];
64  }
int read()
Definition: USInputStream.java:59
byte [] onebuf
Definition: USInputStream.java:39

◆ read() [2/2]

int cx.ath.matthew.unix.USInputStream.read ( byte []  b,
int  off,
int  len 
) throws IOException
inline
66  {
67  if (closed) throw new NotConnectedException();
68  int count = native_recv(sock, b, off, len, flags, timeout);
69  /* Yes, I really want to do this. Recv returns 0 for 'connection shut down'.
70  * read() returns -1 for 'end of stream.
71  * Recv returns -1 for 'EAGAIN' (all other errors cause an exception to be raised)
72  * whereas read() returns 0 for '0 bytes read', so yes, I really want to swap them here.
73  */
74  if (0 == count) return -1;
75  else if (-1 == count) return 0;
76  else return count;
77  }
boolean closed
Definition: USInputStream.java:38
int flags
Definition: USInputStream.java:42
int sock
Definition: USInputStream.java:37
int timeout
Definition: USInputStream.java:43
native int native_recv(int sock, byte[] b, int off, int len, int flags, int timeout)

◆ setBlocking()

void cx.ath.matthew.unix.USInputStream.setBlocking ( boolean  enable)
inline
87  {
88  flags = enable ? 0 : MSG_DONTWAIT;
89  }
static final int MSG_DONTWAIT
Definition: USInputStream.java:33
int flags
Definition: USInputStream.java:42

◆ setSoTimeout()

void cx.ath.matthew.unix.USInputStream.setSoTimeout ( int  timeout)
inline
91  {
92  this.timeout = timeout;
93  }
int timeout
Definition: USInputStream.java:43

メンバ詳解

◆ blocking

boolean cx.ath.matthew.unix.USInputStream.blocking = true
private

◆ closed

boolean cx.ath.matthew.unix.USInputStream.closed = false
package

◆ flags

int cx.ath.matthew.unix.USInputStream.flags = 0
private

◆ MSG_DONTWAIT

final int cx.ath.matthew.unix.USInputStream.MSG_DONTWAIT = 0x40
static

◆ onebuf

byte [] cx.ath.matthew.unix.USInputStream.onebuf = new byte[1]
private

◆ sock

int cx.ath.matthew.unix.USInputStream.sock
private

◆ timeout

int cx.ath.matthew.unix.USInputStream.timeout = 0
private

◆ us

UnixSocket cx.ath.matthew.unix.USInputStream.us
private

このクラス詳解は次のファイルから抽出されました: