public ByteVector() { vector = new ome.codecs.ByteVector(); }
public void add(byte[] array) { add(array, 0, array.length); }
public void clear() { this.vector.clear(); }
ByteVector b = new ByteVector(); for (int i=0; i<raw.length; i++) { b.add((byte) raw[i]); if (raw[i] == (byte) 0xff) { b.add((byte) 0); ByteVector b2 = new ByteVector(); for (int i=0; i<raw2.length; i++) { b2.add((byte) raw2[i]); if (raw2[i] == (byte) 0xff) { b2.add((byte) 0); ByteVector v = new ByteVector(1000); v.add(HEADER); v.add(new byte[] {(byte) 0xff, (byte) 0xdb}); v.add((byte) ((length >>> 8) & 0xff)); v.add((byte) (length & 0xff)); v.add((byte) 0); v.add(quant); v.add((byte) 1); v.add(quant2 == null ? quant : quant2); v.add(new byte[] {(byte) 0xff, (byte) 0xc4}); length = 2; for (Table t : huffmanTables) {
@Override public byte[] decompress(RandomAccessInputStream in, CodecOptions options) throws CodecException, IOException { InflaterInputStream i = new InflaterInputStream(in); ByteVector bytes = new ByteVector(); byte[] buf = new byte[8192]; int r = 0; // read until eof reached try { while ((r = i.read(buf, 0, buf.length)) > 0) bytes.add(buf, 0, r); } catch (EOFException e) { } return bytes.toByteArray(); }
public void add(byte[] pixels, int x, int y, int w, int h) throws CodecException, IOException { toCompress.add(pixels); row++; if ((y % ROW_COUNT) == ROW_COUNT - 1 || y == getHeight() - 1 || y == yy + hh - 1) { Region r = new Region(x, y - row + 1, w, row); options.width = w; options.height = row; options.channels = 1; options.bitsPerSample = 8; options.signed = false; byte[] compressed = codec.compress(toCompress.toByteArray(), options); compressedTiles.put(r, compressed); toCompress.clear(); } }
public int size() { return this.vector.size(); }
public byte get(int index) { return this.vector.get(index); }
public byte[] toByteArray() { return this.vector.toByteArray(); }
public void add(byte x) { while (size >= data.length) doubleCapacity(); data[size++] = x; }
ByteVector dst = new ByteVector(); int t = in.read() & 0xff; int mPos; dst.add(b); t = in.read() & 0xff; return dst.toByteArray(); dst.add(b); t = in.read() & 0xff; if (t < 16) { mPos = dst.size() - 0x801 - (t >> 2) - ((in.read() & 0xff) << 2); if (mPos < 0) { t = LZO_OVERRUN; dst.add(dst.get(mPos++)); } while (--t > 0); dst.add(b); t = in.read() & 0xff; mPos = dst.size() - 1 - ((t >> 2) & 7) - ((in.read() & 0xff) << 3); t = (t >> 5) - 1; mPos = dst.size() - 1 - ((in.read() & 0xff) >> 2); mPos -= ((in.read() & 0xff) << 6); mPos = dst.size() - ((t & 8) << 11);
@Override public byte[] compress(byte[] data, CodecOptions options) throws CodecException { if (data == null || data.length == 0) throw new IllegalArgumentException("No data to compress"); Deflater deflater = new Deflater(); deflater.setInput(data); deflater.finish(); byte[] buf = new byte[8192]; ByteVector bytes = new ByteVector(); int r = 0; // compress until eof reached while ((r = deflater.deflate(buf, 0, buf.length)) > 0) { bytes.add(buf, 0, r); } return bytes.toByteArray(); }
public void add(int[] pixels, int x, int y, int w, int h) throws CodecException, IOException { byte[] buf = new byte[pixels.length * 3]; for (int i=0; i<pixels.length; i++) { buf[i * 3] = (byte) ((pixels[i] & 0xff0000) >> 16); buf[i * 3 + 1] = (byte) ((pixels[i] & 0xff00) >> 8); buf[i * 3 + 2] = (byte) (pixels[i] & 0xff); } toCompress.add(buf); row++; if ((y % ROW_COUNT) == ROW_COUNT - 1 || y == getHeight() - 1 || y == yy + hh - 1) { Region r = new Region(x, y - row + 1, w, row); options.width = w; options.height = row; options.channels = 3; options.bitsPerSample = 8; options.signed = false; byte[] compressed = codec.compress(toCompress.toByteArray(), options); compressedTiles.put(r, compressed); toCompress.clear(); row = 0; } }
public int size() { return this.vector.size(); }
public byte get(int index) { return this.vector.get(index); }
public byte[] toByteArray() { return this.vector.toByteArray(); }
public void add(byte[] array, int off, int len) { while (data.length < size + len) doubleCapacity(); if (len == 1) data[size] = array[off]; else if (len < 35) { // for loop is faster for small number of elements for (int i=0; i<len; i++) data[size + i] = array[off + i]; } else System.arraycopy(array, off, data, size, len); size += len; }
int fewerThan24 = dataBits % 24; int numTriples = dataBits / 24; ByteVector encoded = new ByteVector(); (byte) ((b3) >> 6 ^ 0xfc); encoded.add(lookupBase64Alphabet[v1]); encoded.add(lookupBase64Alphabet[v2 | (k << 4)]); encoded.add(lookupBase64Alphabet[(l << 2) | v3]); encoded.add(lookupBase64Alphabet[b3 & 0x3f]); byte v = ((b1 & -128) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); encoded.add(lookupBase64Alphabet[v]); encoded.add(lookupBase64Alphabet[k << 4]); encoded.add(PAD); encoded.add(PAD); (byte) ((b2) >> 4 ^ 0xf0); encoded.add(lookupBase64Alphabet[v1]); encoded.add(lookupBase64Alphabet[v2 | (k << 4)]); encoded.add(lookupBase64Alphabet[l << 2]); encoded.add(PAD); return encoded.toByteArray();
public void add(byte x) { this.vector.add(x); }
public ByteVector(int initialSize) { vector = new ome.codecs.ByteVector(initialSize); }