Package java.io

Examples of java.io.RandomAccessFile.readByte()


                            byte [] zfieNameBytes = new byte[zfieNameBytesLen];
                            raf.read(zfieNameBytes);
                            String eName = new String(zfieNameBytes, "UTF-8");

                            // Read isDir
                            boolean eIsDir = raf.readByte() == (byte)0 ? false : true;

                            // Read offset of bytes in the real Jar/Zip file
                            int eOffset = raf.readInt();

                            // Read size of the file in the real Jar/Zip file
View Full Code Here


            {
                if ( source.length() >= 1 )
                {
                    raf = new RandomAccessFile( source, "r" );
                    raf.seek( source.length() - 1 );
                    byte last = raf.readByte();
                    if ( last == '\n' )
                    {
                        eofChars = lineEndings.getLineEndingCharacters();
                    }
                }
View Full Code Here

                RandomAccessFile pidFile = new RandomAccessFile(pid, "r");

                StringBuilder b = new StringBuilder();

                while (pidFile.getFilePointer() < (pidFile.length() - 1)) // we don't need newline
                   b.append((char) pidFile.readByte());

                String cmd = "kill -KILL " + b.toString();
                log.info("Executing {}", cmd);
                Process kill = Runtime.getRuntime().exec(cmd);
                kill.waitFor();
View Full Code Here

                checksumBeforeCorruption = CodecUtil.retrieveChecksum(input);
            }
            try (RandomAccessFile raf = new RandomAccessFile(fileToCorrupt, "rw")) {
                raf.seek(randomIntBetween(0, (int)Math.min(Integer.MAX_VALUE, raf.length()-1)));
                long filePointer = raf.getFilePointer();
                byte b = raf.readByte();
                raf.seek(filePointer);
                raf.writeByte(~b);
                raf.getFD().sync();
                logger.debug("Corrupting file {} --  flipping at position {} from {} to {} ", fileToCorrupt.getName(), filePointer, Integer.toHexString(b), Integer.toHexString(~b));
            }
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.