Package java.io

Examples of java.io.InputStream.skip()


        }
        InputStream in = getBinaryStream();
        try {
          long skipped = 0;
          while (pos > 0) {
            skipped = in.skip(pos);
            pos -= skipped;
          }
          return ObjectConverterUtil.convertToByteArray(in, length);
        } catch (IOException e) {
          throw new SQLException(e);
View Full Code Here


            int lastMod = 1;
            for (int i = 0; i < patternLength; i++) {
              lastMod *= MOD;
            }             
            targetStream.skip(start);
            laggingTargetStream.skip(start);
           
            long position = start + 1;
           
            int streamHash = computeStreamHash(targetStream, patternLength);
           
View Full Code Here

          }
        }

        in = new FileInputStream(file);
        while (sr > 0) {
          long sl = in.skip(sr);
          if (sl > 0)
            sr -= sl;
          else {
            res.sendError(HttpServletResponse.SC_CONFLICT, "Conflict");
            // better can be Internal Server Error
View Full Code Here

            for (int j = 0; j < buff.length; j += 10000) {
                prep.setInt(1, i);
                ResultSet rs = prep.executeQuery();
                rs.next();
                InputStream in = rs.getBinaryStream(2);
                in.skip(j);
                int t = in.read();
                assertEquals(t, buff[j] & 0xff);
            }
        }
        conn.close();
View Full Code Here

    boolean threw = true;
    InputStream in = supplier.getInput();
    try {
      while (true) {
        // We skip only Integer.MAX_VALUE due to JDK overflow bugs.
        long amt = in.skip(Integer.MAX_VALUE);
        if (amt == 0) {
          if (in.read() == -1) {
            threw = false;
            return count;
          }
View Full Code Here

        httpResp.addHeader("Content-Length", Long.toString(fileSize + 13));
        byte[] flvHeader = new byte[] {70, 76, 86, 1, 1, 0, 0, 0, 9, 0, 0, 0, 9};
        out.write(flvHeader);
      }

      s.skip(seekPos);
     
      int readSize = 0;

      final int bufferSize = 1024 * 10;
      long left = fileSize;
View Full Code Here

        try
        {
            stream = byteSource.getInputStream();
            long toSkip = byteSource.getLength() - 769;
            while (toSkip > 0)
                toSkip -= stream.skip(toSkip);
            return read256ColorPalette(stream);
        }
        finally
        {
            try
View Full Code Here

     */
    public static void copyRange(final File source, final OutputStream dest, final int start) throws IOException {
        InputStream fis = null;
        try {
            fis = new FileInputStream(source);
            final long skipped = fis.skip(start);
            if (skipped != start) throw new IllegalStateException("Unable to skip '" + start + "' bytes. Only '" + skipped + "' bytes skipped.");
            copy(fis, dest, -1);
        } finally {
            if (fis != null) try { fis.close(); } catch (final Exception e) {}
        }
View Full Code Here

        os.write(id3v2HeadTag);

      is = new FileInputStream(src);
      is = new BufferedInputStream(is);

      is.skip(id3v2HeadLength);

      long total_to_read = src.length();
      total_to_read -= id3v1Length;
      total_to_read -= id3v2HeadLength;
      total_to_read -= id3v2TailLength;
View Full Code Here

    try
    {
      is = new FileInputStream(file);
      is = new BufferedInputStream(is);

      is.skip(length - ID3_V1_TAG_LENGTH);

      bytes = FileUtils.readArray(is, ID3_V1_TAG_LENGTH);
    } finally
    {
      try
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.