r() публичный Метод

Read a byte using a Java primitive int. Most reads route to this method for efficient mapping to a java.io.InputStream. If we aren't overriding this method, then route back to read() for the subclass to handle.
public r ( ) : int
Результат int
Пример #1
0
            public override int decode(InStream @in)
            {
                int c1 = @in.r();
                int c2 = @in.r();

                if ((c1 | c2) < 0)
                {
                    return(-1);
                }
                return(c1 | (c2 << 8));
            }
Пример #2
0
            public override int decode(InStream @in)
            {
                int c = @in.r();

                if (c < 0)
                {
                    return(-1);
                }
                int c2, c3;

                switch (c >> 4)
                {
                case 0:
                case 1:
                case 2:
                case 3:
                case 4:
                case 5:
                case 6:
                case 7:
                    /* 0xxxxxxx*/
                    return(c);

                case 12:
                case 13:
                    /* 110x xxxx   10xx xxxx*/
                    c2 = @in.r();
                    if ((c2 & 0xC0) != 0x80)
                    {
                        throw IOErr.make("Invalid UTF-8 encoding").val;
                    }
                    return(((c & 0x1F) << 6) | (c2 & 0x3F));

                case 14:
                    /* 1110 xxxx  10xx xxxx  10xx xxxx */
                    c2 = @in.r();
                    c3 = @in.r();
                    if (((c2 & 0xC0) != 0x80) || ((c3 & 0xC0) != 0x80))
                    {
                        throw IOErr.make("Invalid UTF-8 encoding").val;
                    }
                    return(((c & 0x0F) << 12) | ((c2 & 0x3F) << 6) | ((c3 & 0x3F) << 0));

                default:
                    throw IOErr.make("Invalid UTF-8 encoding").val;
                }
            }
Пример #3
0
            public override int decode(InStream @in)
            {
                // TODO - well shit, how do we know how many bytes to read generically?

                int len = 1;
                int b   = @in.r();

                if (b < 0)
                {
                    return(-1);
                }

                bbuf[0] = (byte)b;

                cbuf = charset.m_encoding.GetChars(bbuf, 0, len);
                return(cbuf[0]);
            }
Пример #4
0
 public override int decode(InStream @in)
 {
     return(@in.r());
 }
Пример #5
0
 public override int decode(InStream @in)
 {
     int c = @in.r();
     if (c < 0) return -1;
     int c2, c3;
     switch (c >> 4)
     {
       case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
     /* 0xxxxxxx*/
     return c;
       case 12: case 13:
     /* 110x xxxx   10xx xxxx*/
     c2 = @in.r();
     if ((c2 & 0xC0) != 0x80)
       throw IOErr.make("Invalid UTF-8 encoding").val;
     return ((c & 0x1F) << 6) | (c2 & 0x3F);
       case 14:
     /* 1110 xxxx  10xx xxxx  10xx xxxx */
     c2 = @in.r();
     c3 = @in.r();
     if (((c2 & 0xC0) != 0x80) || ((c3 & 0xC0) != 0x80))
       throw IOErr.make("Invalid UTF-8 encoding").val;
     return (((c & 0x0F) << 12) | ((c2 & 0x3F) << 6) | ((c3 & 0x3F) << 0));
       default:
     throw IOErr.make("Invalid UTF-8 encoding").val;
     }
 }
Пример #6
0
 public override int decode(InStream @in)
 {
     int c1 = @in.r();
     int c2 = @in.r();
     if ((c1 | c2) < 0) return -1;
     return (c1 | (c2 << 8));
 }
Пример #7
0
 public override int decode(InStream @in)
 {
     return @in.r();
 }
Пример #8
0
            public override int decode(InStream @in)
            {
                // TODO - well shit, how do we know how many bytes to read generically?

                int len = 1;
                int b = @in.r();
                if (b < 0) return -1;

                bbuf[0] = (byte)b;

                cbuf = charset.m_encoding.GetChars(bbuf, 0, len);
                return cbuf[0];
            }