private void openScope(byte opener) throws IOException { out.append(opener); level++; head = true; }
public Acceptor(Listener listener, ConnectionFactory factory, int port) { super("Acceptor-" + listener.getName() + "-" + port); this.listener = listener; this.factory = factory; this.port = port; }
private void enableWrite() { if (!shouldWrite) { listener.modifyInterestOps(this, SelectionKey.OP_WRITE, true); shouldWrite = true; } }
@Override public GenericWriter write(AbstractUtf8Array v) throws java.io.IOException { buffer.append(v); return this; }
/** * Return the number of bytes this writer will produce for the underlying * layer. That is, it sums the length of the raw bytes received and the * number of bytes in the written strings after encoding. * * @return the number of bytes appended to this writer */ public long appended() { return buffer.appended(); } }
/** Convenience method for closing a list of readers. Does nothing if the given reader list is null. */ public static void closeAll(List<Reader> readers) { if (readers==null) return; for (Reader reader : readers) closeReader(reader); }
private void disableWrite() { if (shouldWrite) { listener.modifyInterestOpsBatch(this, SelectionKey.OP_WRITE, false); shouldWrite = false; } }
public void clearAll() { clear(); clearCache(); }
/** * Copies all files and subdirectories (infinitely recursively) in a directory to another. * Any existing files are overwritten. * * @param sourceLocation the source directory * @param targetLocation the target directory * @throws IOException if copying any file fails. This will typically result in some files being copied and * others not, i.e this method is not exception safe */ public static void copyDirectory(File sourceLocation , File targetLocation) throws IOException { copyDirectory(sourceLocation, targetLocation, -1); }
/** * Run all the select loop post hooks */ private void runSelectLoopPostHooks() { if (selectLoopPostHooks == null) { return; } for (SelectLoopHook hook : selectLoopPostHooks) { hook.selectLoopHook(false); } }
@Override public void write(byte[] b) throws IOException { write(b,0,b.length); }
@Override public void close() { flush(); }
public GrowableByteBuffer(ByteBuffer buffer, float growFactor) { this.buffer = buffer; setGrowFactor(growFactor); }
public void append(final byte[] alreadyEncoded) throws java.io.IOException { if (alreadyEncoded.length > 0) { append(alreadyEncoded, 0, alreadyEncoded.length); } }
/** * Give the number of bytes written. * * @return the number of bytes written to this stream */ public long written() { return buffer.appended() + byteBufferData; }
private void encodeDATA(byte[] value) throws IOException { int len = value.length * 2 + 4; byte [] data = new byte[len]; int p = 0; data[p++] = '"'; data[p++] = '0'; data[p++] = 'x'; for (int pos = 0; pos < value.length; pos++) { data[p++] = HEX[(value[pos] >> 4) & 0xf]; data[p++] = HEX[value[pos] & 0xf]; } data[p] = '"'; out.append(data, 0, len); }
/** * Run all the select loop pre hooks */ private void runSelectLoopPreHooks() { if (selectLoopPreHooks == null) { return; } for (SelectLoopHook hook : selectLoopPreHooks) { hook.selectLoopHook(true); } }
public void append(final byte[] alreadyEncoded, final int offset, final int length) throws java.io.IOException { buffer.append(alreadyEncoded, offset, length); }