Package java.io

Examples of java.io.FileInputStream.skip()


            }

            final FileInputStream fis = new FileInputStream(file);

            if (pos > 0) {
                final long actualPos = fis.skip(pos);
            }

            final BufferedInputStream  bis = new BufferedInputStream(fis);
            final CountdownInputStream cis = new CountdownInputStream(bis);
View Full Code Here


      }
      if(isRange()){
        System.out.println("Byte range: "+startByte+" - "+(getRangeSize()>0?endByte:""));
        long skipped=0;
        while(skipped<startByte){
          skipped+=is.skip(startByte);
        }
        ftc.writeAllData(is, endByte-startByte+1);
       
      }else{
        ftc.writeAllData(is);
View Full Code Here

              @Override
              public int available() throws IOException {
                return (int) dataLen;
              }
            };
            fis.skip(startFrom);

            res = new Response(HTTP_PARTIALCONTENT, mime, fis);
            res.addHeader("Content-Length", "" + dataLen);
            res.addHeader("Content-Range", "bytes " + startFrom + "-" + endAt + "/" + fileLen);
            res.addHeader("ETag", etag);
View Full Code Here

     * diffBlockLen); System.err.println ("newsize=" + newsize);
     */

    FileInputStream in;
    in = new FileInputStream(diffFile);
    in.skip(ctrlBlockLen + 32);
    GZIPInputStream diffBlockIn = new GZIPInputStream(in);

    in = new FileInputStream(diffFile);
    in.skip(diffBlockLen + ctrlBlockLen + 32);
    GZIPInputStream extraBlockIn = new GZIPInputStream(in);
View Full Code Here

    in = new FileInputStream(diffFile);
    in.skip(ctrlBlockLen + 32);
    GZIPInputStream diffBlockIn = new GZIPInputStream(in);

    in = new FileInputStream(diffFile);
    in.skip(diffBlockLen + ctrlBlockLen + 32);
    GZIPInputStream extraBlockIn = new GZIPInputStream(in);

    /*
     * Read in old file (file to be patched) to oldBuf
     */
 
View Full Code Here

        {
            fIn = new FileInputStream( pdfFile );
           
            final int trailByteCount = ( fileLen < readTrailBytes ) ? (int) fileLen : readTrailBytes;
            buf = new byte[ trailByteCount ];
            fIn.skip( skipBytes = fileLen - trailByteCount );
           
            int off = 0;
            int readBytes;
            while ( off < trailByteCount )
            {
View Full Code Here

            //new File(mapOutputFileName.toUri().getPath()), runAsUserName);

        ReadaheadRequest curReadahead = null;
       
        //seek to the correct offset for the reduce
        mapOutputIn.skip(info.startOffset);
        long rem = info.partLength;
        long offset = info.startOffset;
        while (rem > 0) {
          if (tracker.manageOsCacheInShuffle && tracker.readaheadPool != null) {
            curReadahead = tracker.readaheadPool.readaheadStream(filePath,
View Full Code Here

        {
            fIn = new FileInputStream(pdfFile);

            final int trailByteCount = (fileLen < readTrailBytes) ? (int) fileLen : readTrailBytes;
            buf = new byte[trailByteCount];
            fIn.skip(skipBytes = fileLen - trailByteCount);

            int off = 0;
            int readBytes;
            while (off < trailByteCount)
            {
View Full Code Here

    byte flags = (byte)(compressedBuf[3] & 0xff);
    if ((flags & 0x04) != 0) {   // FEXTRA
      numBytesRead = in.read(compressedBuf, 0, 2);
      assertEquals("XLEN bytes read", 2, numBytesRead);
      int xlen = ((compressedBuf[1] << 8) | compressedBuf[0]) & 0xffff;
      in.skip(xlen);
    }
    if ((flags & 0x08) != 0) {   // FNAME
      while ((numBytesRead = in.read()) != 0) {
        assertFalse("unexpected end-of-file while reading filename",
                    numBytesRead == -1);
View Full Code Here

            final long dataLen = newLen;
            FileInputStream fis = new FileInputStream( f ) {
              public int available() throws IOException { return (int)dataLen; }
            };
            fis.skip( startFrom );

            res = new Response( HTTP_PARTIALCONTENT, mime, fis );
            res.addHeader( "Content-Length", "" + dataLen);
            res.addHeader( "Content-Range", "bytes " + startFrom + "-" + endAt + "/" + fileLen);
            res.addHeader( "ETag", etag);
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.