Package java.io

Examples of java.io.FileInputStream.skip()


          catch ( NumberFormatException nfe ) {}
        }
      }

      FileInputStream fis = new FileInputStream( f );
      fis.skip( startFrom );
      Response r = new Response( HTTP_OK, mime, fis );
      r.addHeader( "Content-length", "" + (f.length() - startFrom));
      r.addHeader( "Content-range", "" + startFrom + "-" +
            (f.length()-1) + "/" + f.length());
      return r;
View Full Code Here


                int count = ((Integer) l.get(2)).intValue();
                String src = (String) l.get(3);
                InputStream in = new FileInputStream(src);
                byte[] buf = new byte[count];
                if (offset > 0)
                  in.skip(offset);
                int len = in.read(buf);
                if (len >= 0)
                  {
                    pool.addRandomBytes(buf, 0, len);
                    pool.addQuality(qual * ((double) len / (double) count));
View Full Code Here

                int count = ((Integer) l.get(2)).intValue();
                URL src = (URL) l.get(3);
                InputStream in = src.openStream();
                byte[] buf = new byte[count];
                if (offset > 0)
                  in.skip(offset);
                int len = in.read(buf);
                if (len >= 0)
                  {
                    pool.addRandomBytes(buf, 0, len);
                    pool.addQuality(qual * ((double) len / (double) count));
View Full Code Here

                proc = null;
                proc = Runtime.getRuntime().exec(src);
                InputStream in = proc.getInputStream();
                byte[] buf = new byte[count];
                if (offset > 0)
                  in.skip(offset);
                int len = in.read(buf);
                if (len >= 0)
                  {
                    pool.addRandomBytes(buf, 0, len);
                    pool.addQuality(qual * ((double) len / (double) count));
View Full Code Here

    @Override
    public InputStream readFileFrom(FileEntry file, long offset) {
        try {
            FileInputStream in = new FileInputStream(FileSystemTools.getAbsolutePath(file, basePath));
            in.skip(offset);
            return in;
        } catch (Exception ex) {
            throw new FileSystemException("Could not read the file ", ex);
        }
    }
View Full Code Here

    try{
        File f1 = new File(path);
        if(f1.isFile())
        {
          fis = new FileInputStream(path);
          fis.skip(from);

          len = Math.min(fis.available(),len);
          bytes = new byte[len];
          int bytesRead = fis.read(bytes);
        }else
View Full Code Here

  int input;
  int[] temp = new int[nextfourdiv(this.pixelwidth)*(this.pixelheight)];
  try {
      FileInputStream file = new FileInputStream(this.ref);
      int count = 0;
      file.skip((long) this.imagestart);
      while ((input = file.read()) != -1) {
    temp[count++] = input;
      }
      file.close();
  } catch (IOException e) {
View Full Code Here

  int[] temp = new int[nextfourdiv(this.pixelwidth*3)*(this.pixelheight)];
  try{
      FileInputStream file=new FileInputStream(this.ref);
      boolean eof=false;
      int count=0;
      file.skip((long)this.imagestart);
      while (!eof) {
    int input = file.read();
    if (input==-1) {
        eof=true;
    } else {
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

      public InputStream getInputStream() throws IOException {
         InputStream source = new FileInputStream(file);
         int length = last - first;
        
         if(first > 0) {
            source.skip(first);
         }
         return new Range(source, length);
      }
     
      /**
 
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.