RandomAccessFile: readLine()


import java.io.File;
import java.io.FileInputStream;
import java.io.RandomAccessFile;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;

public class Main {
  public static void main(String[] args) throws Exception{
    ZipInputStream zipinputstream = new ZipInputStream(new FileInputStream("filename"));
    ZipEntry zipentry = zipinputstream.getNextEntry();
    while (zipentry != null) {
      String entryName = zipentry.getName();
      File newFile = new File(entryName);
      String directory = newFile.getParent();
      if (directory == null) {
        if (newFile.isDirectory())
          break;
      }
      RandomAccessFile  rf = new RandomAccessFile(entryName, "r");
      String line;
      if ((line = rf.readLine()) != null) {
        System.out.println(line);
      }
      rf.close();
      zipinputstream.closeEntry();
      zipentry = zipinputstream.getNextEntry();
    }
    zipinputstream.close();
  }
}
Home 
  Java Book 
    File Stream  

RandomAccessFile:
  1. RandomAccessFile
  2. new RandomAccessFile(String fileName, String mode)
  3. RandomAccessFile: close()
  4. RandomAccessFile: getChannel()
  5. RandomAccessFile: getFilePointer()
  6. RandomAccessFile: length()
  7. RandomAccessFile: read(byte[] b)
  8. RandomAccessFile: readBoolean()
  9. RandomAccessFile: readByte()
  10. RandomAccessFile: readChar()
  11. RandomAccessFile: readDouble()
  12. RandomAccessFile: readInt()
  13. RandomAccessFile: readLine()
  14. RandomAccessFile: seek(long pos)
  15. RandomAccessFile: write(byte[] b)
  16. RandomAccessFile: writeBoolean(boolean v)
  17. RandomAccessFile: writeBytes(String s)
  18. RandomAccessFile: writeChars(String s)
  19. RandomAccessFile: writeInt(int v)
  20. RandomAccessFile: writeUTF(String str)