public void write(byte[] wBuf, int wOffset, int numToWrite) throws IOException { if ((this.currBytes + numToWrite) > this.currSize) { throw new IOException("request to write '" + numToWrite + "' bytes exceeds size in header of '" + this.currSize + "' bytes");
public void write(int b) throws IOException { this.oneBuf[0] = (byte) b;
    public void write(byte[] wBuf, int wOffset, int numToWrite) throws IOException {        if ((this.currBytes + numToWrite) > this.currSize) {            throw new IOException("request to write '" + numToWrite                                   + "' bytes exceeds size in header of '"                                   + this.currSize + "' bytes");            //             // We have to deal with assembly!!!            // The programmer can be writing little 32 byte chunks for all            // we know, and we must assemble complete records for writing.            // REVIEW Maybe this should be in TarBuffer? Could that help to            // eliminate some of the buffer copying.            //         }         if (this.assemLen > 0) {            if ((this.assemLen + numToWrite) >= this.recordBuf.length) {                int aLen = this.recordBuf.length - this.assemLen;                System.arraycopy(this.assemBuf, 0, this.recordBuf, 0,                                  this.assemLen);                System.arraycopy(wBuf, wOffset, this.recordBuf,                                  this.assemLen, aLen);                this.buffer.writeRecord(this.recordBuf);                this.currBytes += this.recordBuf.length;                wOffset += aLen;                numToWrite -= aLen;                this.assemLen = 0;            } else {                System.arraycopy(wBuf, wOffset, this.assemBuf, this.assemLen,                                  numToWrite);                wOffset += numToWrite;                this.assemLen += numToWrite;                numToWrite -= numToWrite;            }         }         //         // When we get here we have EITHER:        // o An empty "assemble" buffer.        // o No bytes to write (numToWrite == 0)        //         while (numToWrite > 0) {            if (numToWrite < this.recordBuf.length) {                System.arraycopy(wBuf, wOffset, this.assemBuf, this.assemLen,                                  numToWrite);                this.assemLen += numToWrite;                break;            }             this.buffer.writeRecord(wBuf, wOffset);            int num = this.recordBuf.length;            this.currBytes += num;            numToWrite -= num;            wOffset += num;        }     } 