|
| 1 | +package com.example.zip; |
| 2 | + |
| 3 | +import java.io.File; |
| 4 | +import java.io.InputStream; |
| 5 | +import java.nio.charset.Charset; |
| 6 | +import java.util.Enumeration; |
| 7 | +import java.util.zip.ZipEntry; |
| 8 | + |
| 9 | +import liquidjava.specification.ExternalRefinementsFor; |
| 10 | +import liquidjava.specification.StateRefinement; |
| 11 | +import liquidjava.specification.StateSet; |
| 12 | + |
| 13 | + |
| 14 | +/* |
| 15 | +State machine: |
| 16 | +
|
| 17 | +closed |
| 18 | +
|
| 19 | +^ close |
| 20 | +
|
| 21 | +opened. @ getEntry, getIS, stream, entries |
| 22 | +
|
| 23 | +*/ |
| 24 | + |
| 25 | +@ExternalRefinementsFor("java.util.zip.ZipFile") |
| 26 | +@StateSet({"opened", "closed"}) |
| 27 | +public interface ZipFile { |
| 28 | + |
| 29 | + @StateRefinement(to="opened(this)") |
| 30 | + public void ZipFile(File file); |
| 31 | + |
| 32 | + @StateRefinement(to="opened(this)") |
| 33 | + public void ZipFile(File file, int mode); |
| 34 | + |
| 35 | + @StateRefinement(to="opened(this)") |
| 36 | + public void ZipFile(File file, int mode, Charset cs); |
| 37 | + |
| 38 | + @StateRefinement(to="opened(this)") |
| 39 | + public void ZipFile(File file, Charset cs); |
| 40 | + |
| 41 | + @StateRefinement(to="opened(this)") |
| 42 | + public void ZipFile(String name); |
| 43 | + |
| 44 | + @StateRefinement(to="opened(this)") |
| 45 | + public void ZipFile(String name, Charset cs); |
| 46 | + |
| 47 | + @StateRefinement(from="opened(this)", to="closed(this)") |
| 48 | + public void close(); |
| 49 | + |
| 50 | + @StateRefinement(from="opened(this)") |
| 51 | + public Enumeration<? extends ZipEntry> entries(); |
| 52 | + |
| 53 | + @StateRefinement(from="opened(this)") |
| 54 | + public ZipEntry getEntry(String name); |
| 55 | + |
| 56 | + @StateRefinement(from="opened(this)") |
| 57 | + public InputStream getInputStream(ZipEntry e); |
| 58 | + |
| 59 | + |
| 60 | +} |
0 commit comments