From 8a074fba6e5829dc4e90ea0aae6d0cb3e70d3bdb Mon Sep 17 00:00:00 2001 From: "Taro L. Saito" Date: Thu, 22 Sep 2011 16:39:51 +0900 Subject: [PATCH] Fixes issue 29 Javadoc --- .hgsubstate | 2 +- .../org/xerial/snappy/SnappyOutputStream.java | 113 +++++++++++++++++- stylesheet.css | 8 +- 3 files changed, 117 insertions(+), 6 deletions(-) diff --git a/.hgsubstate b/.hgsubstate index f1b0f27..6942afa 100644 --- a/.hgsubstate +++ b/.hgsubstate @@ -1 +1 @@ -e128a6e728fb227ccba98267ebf181fafc56fddf wiki +ebc1867bf9ab3e469995283ac217d429be817c59 wiki diff --git a/src/main/java/org/xerial/snappy/SnappyOutputStream.java b/src/main/java/org/xerial/snappy/SnappyOutputStream.java index 5ae645f..d523a95 100755 --- a/src/main/java/org/xerial/snappy/SnappyOutputStream.java +++ b/src/main/java/org/xerial/snappy/SnappyOutputStream.java @@ -37,8 +37,9 @@ import java.io.OutputStream; * The output data format is: *
    *
  1. snappy codec header defined in {@link SnappyCodec} (8 bytes) - *
  2. a pair of (compressed data size [4 byte integer. Big-endian], compressed - * data...) + *
  3. compressed block 1 : a pair of (compressed data size [4 byte integer. + * Big-endian], compressed data...) + *
  4. compressed block 2 *
  5. ... *
* @@ -65,6 +66,12 @@ public class SnappyOutputStream extends OutputStream this(out, DEFAULT_BLOCK_SIZE); } + /** + * @param out + * @param blockSize + * byte size of the internal buffer size + * @throws IOException + */ public SnappyOutputStream(OutputStream out, int blockSize) throws IOException { this.out = out; this.blockSize = blockSize; @@ -77,6 +84,16 @@ public class SnappyOutputStream extends OutputStream SnappyCodec.currentHeader().writeHeader(out); } + /** + * Writes len bytes from the specified byte array starting at offset off to + * this output stream. The general contract for write(b, off, len) is that + * some of the bytes in the array b are written to the output stream in + * order; element b[off] is the first byte written and b[off+len-1] is the + * last byte written by this operation. + */ + /* (non-Javadoc) + * @see java.io.OutputStream#write(byte[], int, int) + */ @Override public void write(byte[] b, int off, int len) throws IOException { rawWrite(b, off, len); @@ -97,38 +114,112 @@ public class SnappyOutputStream extends OutputStream rawWrite(d, off * 8, len * 8); } + /** + * Compress the input double array data + * + * @param f + * input array + * @param off + * offset in the array + * @param len + * the number of elements in the array to copy + * @throws IOException + */ public void write(double[] f, int off, int len) throws IOException { rawWrite(f, off * 8, len * 8); } + /** + * Compress the input float array data + * + * @param f + * input array + * @param off + * offset in the array + * @param len + * the number of elements in the array to copy + * @throws IOException + */ public void write(float[] f, int off, int len) throws IOException { rawWrite(f, off * 4, len * 4); } + /** + * Compress the input int array data + * + * @param f + * input array + * @param off + * offset in the array + * @param len + * the number of elements in the array to copy + * @throws IOException + */ public void write(int[] f, int off, int len) throws IOException { rawWrite(f, off * 4, len * 4); } + /** + * Compress the input short array data + * + * @param f + * input array + * @param off + * offset in the array + * @param len + * the number of elements in the array to copy + * @throws IOException + */ public void write(short[] f, int off, int len) throws IOException { rawWrite(f, off * 2, len * 2); } + /** + * Compress the input array data + * + * @param d + * @throws IOException + */ public void write(long[] d) throws IOException { write(d, 0, d.length); } + /** + * Compress the input array data + * + * @param f + * @throws IOException + */ public void write(double[] f) throws IOException { write(f, 0, f.length); } + /** + * Compress the input array data + * + * @param f + * @throws IOException + */ public void write(float[] f) throws IOException { write(f, 0, f.length); } + /** + * Compress the input array data + * + * @param f + * @throws IOException + */ public void write(int[] f) throws IOException { write(f, 0, f.length); } + /** + * Compress the input array data + * + * @param f + * @throws IOException + */ public void write(short[] f) throws IOException { write(f, 0, f.length); } @@ -155,6 +246,15 @@ public class SnappyOutputStream extends OutputStream } } + /** + * Writes the specified byte to this output stream. The general contract for + * write is that one byte is written to the output stream. The byte to be + * written is the eight low-order bits of the argument b. The 24 high-order + * bits of b are ignored. + */ + /* (non-Javadoc) + * @see java.io.OutputStream#write(int) + */ @Override public void write(int b) throws IOException { if (cursor >= uncompressed.length) { @@ -163,6 +263,9 @@ public class SnappyOutputStream extends OutputStream uncompressed[cursor++] = (byte) b; } + /* (non-Javadoc) + * @see java.io.OutputStream#flush() + */ @Override public void flush() throws IOException { dump(); @@ -195,6 +298,12 @@ public class SnappyOutputStream extends OutputStream cursor = 0; } + /** + * close the stream + */ + /* (non-Javadoc) + * @see java.io.OutputStream#close() + */ @Override public void close() throws IOException { flush(); diff --git a/stylesheet.css b/stylesheet.css index 5161451..2683c03 100755 --- a/stylesheet.css +++ b/stylesheet.css @@ -5,14 +5,16 @@ /* Page background color */ body { background-color: #FFFFFF; color:#000000; font-family: Arial, sans-serif; } +code { font-family: mono-space, Arial, sans-serif; } + /* Headings */ h1 { font-size: 145% } a:link { color: #006699; } -a:hover { color: #6699CC; } +a:hover { color: #6699CC; } a:active { color: #6699CC; } -a:visited { color: #669999; } - +a:visited { color: #333366; } + /* Table colors */ .TableHeadingColor { background: #3399CC; color:#FFFFFF } /* Dark mauve */ .TableSubHeadingColor { background: #EEEEFF; color:#000000 } /* Light mauve */