longValue() public method

public longValue ( ) : long
return long
示例#1
0
 //////////////////////////////////////////////////////////////////////////
 // Constructor
 //////////////////////////////////////////////////////////////////////////
 public static SysInStream make(Stream input, Long bufSize)
 {
     if (bufSize == null || bufSize.longValue() == 0)
     return new SysInStream(input);
       else
     return new SysInStream(new BufferedStream(input, bufSize.intValue()));
 }
示例#2
0
        public override InStream @in(Long bufSize)
        {
            try
              {
            System.IO.Stream ins;
            if (m_parent is Zip)
            {
              // never buffer if using ZipInputStream
              ins = new ZipEntryInputStream((m_parent as Zip).m_zipIn);
            }
            else
            {
              ins = (m_parent as ZipFile).GetInputStream(m_entry);

              // buffer if specified
              if (bufSize != null && bufSize.longValue() != 0)
            ins = new System.IO.BufferedStream(ins, bufSize.intValue());
            }

            // return as fan stream
            return new SysInStream(ins);
              }
              catch (System.IO.IOException e)
              {
            throw IOErr.make(e).val;
              }
        }
示例#3
0
 public static Stream toBuffered(Stream output, Long bufSize)
 {
     if (bufSize == null || bufSize.longValue() == 0)
     return output;
       else
     return new BufferedStream(output, bufSize.intValue());
 }
示例#4
0
        public override InStream @in(Long bufSize)
        {
            try
            {
                System.IO.Stream ins;
                if (m_parent is Zip)
                {
                    // never buffer if using ZipInputStream
                    ins = new ZipEntryInputStream((m_parent as Zip).m_zipIn);
                }
                else
                {
                    ins = (m_parent as ZipFile).GetInputStream(m_entry);

                    // buffer if specified
                    if (bufSize != null && bufSize.longValue() != 0)
                    {
                        ins = new System.IO.BufferedStream(ins, bufSize.intValue());
                    }
                }

                // return as fan stream
                return(new SysInStream(ins));
            }
            catch (System.IO.IOException e)
            {
                throw IOErr.make(e).val;
            }
        }
示例#5
0
        public virtual Long peekChar()
        {
            Long x = readChar();

            if (x != null)
            {
                unreadChar(x.longValue());
            }
            return(x);
        }
示例#6
0
        //////////////////////////////////////////////////////////////////////////
        // Constructor
        //////////////////////////////////////////////////////////////////////////

        public static SysInStream make(Stream input, Long bufSize)
        {
            if (bufSize == null || bufSize.longValue() == 0)
            {
                return(new SysInStream(input));
            }
            else
            {
                return(new SysInStream(new BufferedStream(input, bufSize.intValue())));
            }
        }
示例#7
0
 public static Stream toBuffered(Stream output, Long bufSize)
 {
     if (bufSize == null || bufSize.longValue() == 0)
     {
         return(output);
     }
     else
     {
         return(new BufferedStream(output, bufSize.intValue()));
     }
 }
示例#8
0
文件: List.cs 项目: syatanic/fantom
        public object removeSame(object val)
        {
            // modify in removeAt(long)
            Long i = indexSame(val);

            if (i == null)
            {
                return(null);
            }
            return(removeAt(i.longValue()));
        }
示例#9
0
        public virtual Buf readBufFully(Buf buf, long n)
        {
            if (buf == null)
            {
                buf = Buf.make(n);
            }

            long total = n;
            long got   = 0;

            while (got < total)
            {
                Long r = readBuf(buf, total - got);
                if (r == null || r.longValue() == 0)
                {
                    throw IOErr.make("Unexpected end of stream").val;
                }
                got += r.longValue();
            }

            buf.flip();
            return(buf);
        }
示例#10
0
文件: List.cs 项目: syatanic/fantom
        public List moveTo(object item, long toIndex)
        {
            modify();
            Long curIndex = index(item);

            if (curIndex == null)
            {
                return(this);
            }
            if (curIndex.longValue() == toIndex)
            {
                return(this);
            }
            removeAt(curIndex.longValue());
            if (toIndex == -1)
            {
                return(add(item));
            }
            if (toIndex < 0)
            {
                ++toIndex;
            }
            return(insert(toIndex, item));
        }
示例#11
0
 public virtual long pipe(OutStream output, Long toPipe, bool cls)
 {
     try
     {
         long bufSize = FanInt.Chunk.longValue();
         Buf  buf     = Buf.make(bufSize);
         long total   = 0;
         if (toPipe == null)
         {
             while (true)
             {
                 Long n = readBuf(buf.clear(), bufSize);
                 if (n == null)
                 {
                     break;
                 }
                 output.writeBuf(buf.flip(), buf.remaining());
                 total += n.longValue();
             }
         }
         else
         {
             long toPipeVal = toPipe.longValue();
             while (total < toPipeVal)
             {
                 if (toPipeVal - total < bufSize)
                 {
                     bufSize = toPipeVal - total;
                 }
                 Long n = readBuf(buf.clear(), bufSize);
                 if (n == null)
                 {
                     throw IOErr.make("Unexpected end of stream").val;
                 }
                 output.writeBuf(buf.flip(), buf.remaining());
                 total += n.longValue();
             }
         }
         return(total);
     }
     finally
     {
         if (cls)
         {
             close();
         }
     }
 }
示例#12
0
        public virtual string readLine(Long max)
        {
            // max limit
            int maxChars = System.Int32.MaxValue;

            if (max != null)
            {
                long maxLong = max.longValue();
                if (maxLong == 0L)
                {
                    return("");
                }
                if (maxLong < 0)
                {
                    throw ArgErr.make("Invalid max: " + max).val;
                }
                if (maxLong < System.Int32.MaxValue)
                {
                    maxChars = (int)maxLong;
                }
            }

            // read first char, if at end of file bail
            int c = rChar();

            if (c < 0)
            {
                return(null);
            }

            // loop reading chars until we hit newline
            // combo or end of stream
            StringBuilder buf = new StringBuilder(256);

            while (true)
            {
                // check for \n, \r\n, or \r
                if (c == '\n')
                {
                    break;
                }
                if (c == '\r')
                {
                    c = rChar();
                    if (c >= 0 && c != '\n')
                    {
                        unreadChar(c);
                    }
                    break;
                }

                // Append to working buffer
                buf.Append((char)c);
                if (buf.Length >= maxChars)
                {
                    break;
                }

                // read next char
                c = rChar();
                if (c < 0)
                {
                    break;
                }
            }
            return(buf.ToString());
        }
示例#13
0
文件: InStream.cs 项目: nomit007/f4
        public virtual string readLine(Long max)
        {
            // max limit
              int maxChars = System.Int32.MaxValue;
              if (max != null)
              {
            long maxLong = max.longValue();
            if (maxLong == 0L) return "";
            if (maxLong < 0) throw ArgErr.make("Invalid max: " + max).val;
            if (maxLong < System.Int32.MaxValue)
              maxChars = (int)maxLong;
              }

              // read first char, if at end of file bail
              int c = rChar();
              if (c < 0) return null;

              // loop reading chars until we hit newline
              // combo or end of stream
              StringBuilder buf = new StringBuilder(256);
              while (true)
              {
            // check for \n, \r\n, or \r
            if (c == '\n') break;
            if (c == '\r')
            {
              c = rChar();
              if (c >= 0 && c != '\n') unreadChar(c);
              break;
            }

            // Append to working buffer
            buf.Append((char)c);
            if (buf.Length >= maxChars) break;

            // read next char
            c = rChar();
            if (c < 0) break;
              }
              return buf.ToString();
        }
示例#14
0
文件: InStream.cs 项目: nomit007/f4
 public virtual long pipe(OutStream output, Long toPipe, bool cls)
 {
     try
       {
     long bufSize = FanInt.Chunk.longValue();
     Buf buf = Buf.make(bufSize);
     long total = 0;
     if (toPipe == null)
     {
       while (true)
       {
     Long n = readBuf(buf.clear(), bufSize);
     if (n == null) break;
     output.writeBuf(buf.flip(), buf.remaining());
     total += n.longValue();
       }
     }
     else
     {
       long toPipeVal = toPipe.longValue();
       while (total < toPipeVal)
       {
     if (toPipeVal - total < bufSize) bufSize = toPipeVal - total;
     Long n = readBuf(buf.clear(), bufSize);
     if (n == null) throw IOErr.make("Unexpected end of stream").val;
     output.writeBuf(buf.flip(), buf.remaining());
     total += n.longValue();
       }
     }
     return total;
       }
       finally
       {
     if (cls) close();
       }
 }