|
| 1 | +package com.zipOutputStream; |
| 2 | + |
| 3 | +import java.io.IOException; |
| 4 | +import java.io.OutputStream; |
| 5 | +import java.nio.charset.Charset; |
| 6 | +import java.util.zip.ZipEntry; |
| 7 | + |
| 8 | +import liquidjava.specification.ExternalRefinementsFor; |
| 9 | +import liquidjava.specification.Refinement; |
| 10 | +import liquidjava.specification.RefinementAlias; |
| 11 | +import liquidjava.specification.StateRefinement; |
| 12 | +import liquidjava.specification.StateSet; |
| 13 | + |
| 14 | +@RefinementAlias("Positive(int v) { v >= 0 }") |
| 15 | +@RefinementAlias("Level(int v) { 0 <= v && v <= 9 }") |
| 16 | +@StateSet({"open", "ready", "closed"}) |
| 17 | +@ExternalRefinementsFor("java.util.zip.ZipOutputStream") |
| 18 | +public interface ZipOutputStreamRefinements { |
| 19 | + |
| 20 | + @StateRefinement(to="open(this)") |
| 21 | + public void ZipOutputStream(OutputStream out); |
| 22 | + |
| 23 | + @StateRefinement(to="open(this)") |
| 24 | + public void ZipOutputStream(OutputStream out, Charset charset); |
| 25 | + |
| 26 | + @StateRefinement(from="open(this)", to="open(this)") |
| 27 | + public void setComment(/*@Refinement("'length(_) <= 65535'")*/String comment); |
| 28 | + |
| 29 | + @StateRefinement(from="open(this)", to="open(this)") |
| 30 | + public void setMethod(@Refinement("Positive(_)") int method); // too many different possible values, none of them are negative though |
| 31 | + |
| 32 | + @StateRefinement(from="open(this)", to="open(this)") |
| 33 | + public void setLevel(@Refinement("Level(_)") int level); |
| 34 | + |
| 35 | + @StateRefinement(from="open(this)", to="ready(this)") |
| 36 | + public void putNextEntry(ZipEntry e) throws IOException; |
| 37 | + |
| 38 | + @StateRefinement(from="ready(this)", to="open(this)") |
| 39 | + public void closeEntry() throws IOException; |
| 40 | + |
| 41 | + @StateRefinement(from="ready(this)", to="ready(this)") |
| 42 | + public void write(byte[] b, @Refinement("Positive(_)") int off, @Refinement("Positive(_)") int len) throws IOException; |
| 43 | + |
| 44 | + @StateRefinement(from="ready(this)", to="ready(this)") |
| 45 | + public void finish() throws IOException; |
| 46 | + |
| 47 | + @StateRefinement(from="!closed(this)", to="closed(this)") |
| 48 | + public void close() throws IOException; |
| 49 | +} |
0 commit comments