ByteOutputStream bos = null; try { bos = new ByteOutputStream(); bos.write(is); } finally { if (bos != null) is.close(); return bos.toByteArray();
in = baos.newInputStream(); } finally { if (baos != null) baos.close();
@Override public void write(byte[] b, int off, int len) { ensureCapacity(len); System.arraycopy(b, off, buf, count, len); count += len; }
ByteOutputStream bos = null; try { bos = new ByteOutputStream(); bos.write(is); content = bos.getBytes(); contentLength = bos.getCount(); } catch (IOException ioex) { throw new MessagingException("Error reading input stream", ioex); } finally { if (bos != null) bos.close();
ByteOutputStream bout = null; try { bout = new ByteOutputStream(); bout.write(is); this.in = bout.newInputStream(); } finally { if (bout != null) bout.close();
buf = new ByteOutputStream(); int b; boolean bol = true; // beginning of line flag bol = false; if (buf != null) buf.write(b); } finally { if (buf != null) buf.close();
ByteOutputStream baos = new ByteOuputStream(); DataOutputStream dos = new DataOutputStream(baos); dos.writeInt(x); dos.close(); bytes = baos.toByteArray();
if (prevBuffer[1] == '\n') { if (prevBuffer[0] != '\r' && prevBuffer[0] != '\n') { out.write(prevBuffer, 0, 1); posVector[0] = endPos - 2; } else { out.write(prevBuffer, 0, s - 2); posVector[0] = endPos - 1; } else { out.write(prevBuffer, 0, s - 1); out.write(prevBuffer, 0, s - 1); } else { out.write(prevBuffer, 0, s); out.write(prevBuffer, 0, s); out.write(prevBuffer, 0, s);
headers, baos.getBytes(), baos.getCount()); addBodyPart(mbp); return mbp;
/** * Writes a string as ASCII string. * * @param s string to write. */ public void writeAsAscii(String s) { int len = s.length(); ensureCapacity(len); int ptr = count; for( int i=0; i<len; i++ ) buf[ptr++] = (byte)s.charAt(i); count = ptr; }