@Override public void write(byte[] b, int off, int len) { if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length) || ((off + len) < 0)) { throw new IndexOutOfBoundsException(); } else if (len == 0) { return; } int newcount = count + len; if (newcount > buf.length) { char newbuf[] = new char[Math.max(buf.length << 1, newcount)]; System.arraycopy(buf, 0, newbuf, 0, count); buf = newbuf; } for (int i = 0; i < len; i++) { writeChar(b[off + i]); } }
@Override public String generateStringKeyFor(final Object key) throws IOException { if (key instanceof String) { String stringKey = (String) key; // disallow Strings that start with our marker if (stringKey.length() >= 1) { if (stringKey.charAt(0) == MARKER) { // throw new IOException("Illegal string key: " + stringKey); } } return stringKey; } StringSerializedObjectOutputStream out = new StringSerializedObjectOutputStream(); ObjectOutputStream oos = new OOS(out, oscSerializer); writeStringKey(key, oos); oos.close(); return out.toString(); }
@Override public String generateStringKeyFor(final Object key) throws IOException { if (key instanceof String) { String stringKey = (String) key; // disallow Strings that start with our marker if (stringKey.length() >= 1) { if (stringKey.charAt(0) == MARKER) { // throw new IOException("Illegal string key: " + stringKey); } } return stringKey; } StringSerializedObjectOutputStream out = new StringSerializedObjectOutputStream(); ObjectOutputStream oos = new OOS(out, oscSerializer); writeStringKey(key, oos); oos.close(); return out.toString(); }
@Override public void write(byte[] b, int off, int len) { if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length) || ((off + len) < 0)) { throw new IndexOutOfBoundsException(); } else if (len == 0) { return; } int newcount = count + len; if (newcount > buf.length) { char newbuf[] = new char[Math.max(buf.length << 1, newcount)]; System.arraycopy(buf, 0, newbuf, 0, count); buf = newbuf; } for (int i = 0; i < len; i++) { writeChar(b[off + i]); } }
@Override public void write(int b) { if (count + 1 > buf.length) { char[] newbuf = new char[buf.length << 1]; System.arraycopy(buf, 0, newbuf, 0, count); buf = newbuf; } writeChar(b); }
@Override public void write(int b) { if (count + 1 > buf.length) { char[] newbuf = new char[buf.length << 1]; System.arraycopy(buf, 0, newbuf, 0, count); buf = newbuf; } writeChar(b); }