Package java.io

Examples of java.io.FileInputStream.skip()


        FileInputStream strm = null;
        byte[] currentSize = new byte[8];
        byte[] creatorApp = new byte[4];
        try {
            strm = new FileInputStream(vhdFile);
            strm.skip(info.size - vhdFooterSize + vhdFooterCreatorAppOffset);
            strm.read(creatorApp);
            strm.skip(vhdFooterCurrentSizeOffset - vhdFooterCreatorVerOffset);
            strm.read(currentSize);
        } catch (Exception e) {
            s_logger.warn("Unable to read vhd file " + vhdPath, e);
View Full Code Here


        byte[] creatorApp = new byte[4];
        try {
            strm = new FileInputStream(vhdFile);
            strm.skip(info.size - vhdFooterSize + vhdFooterCreatorAppOffset);
            strm.read(creatorApp);
            strm.skip(vhdFooterCurrentSizeOffset - vhdFooterCreatorVerOffset);
            strm.read(currentSize);
        } catch (Exception e) {
            s_logger.warn("Unable to read vhd file " + vhdPath, e);
            throw new InternalErrorException("Unable to read vhd file " + vhdPath + ": " + e);
        } finally {
View Full Code Here

        FileInputStream strm = null;
        byte[] currentSize = new byte[8];
        byte[] creatorApp = new byte[4];
        try {
            strm = new FileInputStream(file);
            strm.skip(file.length() - vhdFooterSize + vhdFooterCreatorAppOffset);
            strm.read(creatorApp);
            strm.skip(vhdFooterCurrentSizeOffset - vhdFooterCreatorVerOffset);
            strm.read(currentSize);
        } catch (Exception e) {
            s_logger.warn("Unable to read vhd file " + file.getAbsolutePath(), e);
View Full Code Here

        byte[] creatorApp = new byte[4];
        try {
            strm = new FileInputStream(file);
            strm.skip(file.length() - vhdFooterSize + vhdFooterCreatorAppOffset);
            strm.read(creatorApp);
            strm.skip(vhdFooterCurrentSizeOffset - vhdFooterCreatorVerOffset);
            strm.read(currentSize);
        } catch (Exception e) {
            s_logger.warn("Unable to read vhd file " + file.getAbsolutePath(), e);
            throw new CloudRuntimeException("Unable to read vhd file " + file.getAbsolutePath() + ": " + e);
        } finally {
View Full Code Here

        info.size = _storage.getSize(qcow2Path);
        FileInputStream strm = null;
        byte[] b = new byte[8];
        try {
            strm = new FileInputStream(qcow2File);
            strm.skip(24);
            strm.read(b);
        } catch (Exception e) {
            s_logger.warn("Unable to read qcow2 file " + qcow2Path, e);
            return null;
        } finally {
View Full Code Here

    public Long getVirtualSize(File file) {
        FileInputStream strm = null;
        byte[] b = new byte[8];
        try {
            strm = new FileInputStream(file);
            strm.skip(24);
            strm.read(b);
        } catch (Exception e) {
            s_logger.warn("Unable to read qcow2 file " + file, e);
            return null;
        } finally {
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

        FileInputStream strm = null;
        byte[] currentSize = new byte[8];
        byte[] creatorApp = new byte[4];
        try {
            strm = new FileInputStream(vhdFile);
            strm.skip(info.size - vhd_footer_size + vhd_footer_creator_app_offset);
            strm.read(creatorApp);
            strm.skip(vhd_footer_current_size_offset - vhd_footer_creator_ver_offset);
            strm.read(currentSize);          
        } catch (Exception e) {
            s_logger.warn("Unable to read vhd file " + vhdPath, e);
View Full Code Here

        byte[] creatorApp = new byte[4];
        try {
            strm = new FileInputStream(vhdFile);
            strm.skip(info.size - vhd_footer_size + vhd_footer_creator_app_offset);
            strm.read(creatorApp);
            strm.skip(vhd_footer_current_size_offset - vhd_footer_creator_ver_offset);
            strm.read(currentSize);          
        } catch (Exception e) {
            s_logger.warn("Unable to read vhd file " + vhdPath, e);
            throw new InternalErrorException("Unable to read vhd file " + vhdPath + ": " + e);
        } finally {
View Full Code Here

        info.size = _storage.getSize(qcow2Path);
        FileInputStream strm = null;
        byte[] b = new byte[8];
        try {
            strm = new FileInputStream(qcow2File);
            strm.skip(24);
            strm.read(b);
        } catch (Exception e) {
            s_logger.warn("Unable to read qcow2 file " + qcow2Path, e);
            return null;
        } finally {
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.