Esempio n. 1
0
 @Override
 public void write(int c) throws IOException {
   if (c == '\n') {
     super.write(0xa);
     super.write(0xd);
   } else {
     super.write(c);
   }
 }
 public void writeln(String s) throws MessagingException {
   try {
     byte abyte0[] = getBytes(s);
     super.out.write(abyte0);
     super.out.write(newline);
   } catch (Exception exception) {
     throw new MessagingException("IOException", exception);
   }
 }
Esempio n. 3
0
 @Override
 public void write(int oneByte) throws IOException {
   if (oneByte == '\r') {
     state = STATE_CR;
   } else if ((state == STATE_CR) && (oneByte == '\n')) {
     state = STATE_CRLF;
   } else if ((state == STATE_CRLF) && (oneByte == '.')) {
     // Read <CR><LF><DOT> so this line needs an additional period.
     super.write('.');
     state = STATE_NORMAL;
   } else {
     state = STATE_NORMAL;
   }
   super.write(oneByte);
 }
 public void writeln() throws MessagingException {
   try {
     super.out.write(newline);
   } catch (Exception exception) {
     throw new MessagingException("IOException", exception);
   }
 }
Esempio n. 5
0
 @Override
 public void write(int b) throws IOException {
   if (checkWithinLimits(1)) {
     super.write(b);
     count++;
   }
 }
Esempio n. 6
0
 @Override
 public void write(byte[] b) throws IOException {
   if (checkWithinLimits(b.length)) {
     super.write(b);
     count += b.length;
   }
 }
Esempio n. 7
0
 @Override
 public void write(byte[] b, int off, int len) throws IOException {
   if (checkWithinLimits(len)) {
     super.write(b, off, len);
     count += len;
   }
 }
Esempio n. 8
0
 public void write(int c) throws IOException {
   inbuf[i] = c;
   i++;
   if (i == 3) {
     super.write(toBase64[(inbuf[0] & 0xFC) >> 2]);
     super.write(toBase64[((inbuf[0] & 0x03) << 4) | ((inbuf[1] & 0xF0) >> 4)]);
     super.write(toBase64[((inbuf[1] & 0x0F) << 2) | ((inbuf[2] & 0xC0) >> 6)]);
     super.write(toBase64[inbuf[2] & 0x3F]);
     col += 4;
     i = 0;
     if (col >= 76) {
       super.write('\n');
       col = 0;
     }
   }
 }
  public void close() throws IOException {
    for (int i = 1; i < databuffer.length; i++) {
      super.write(databuffer[i]);
    }

    super.flush();
    super.close();
  }
Esempio n. 10
0
 @Override
 public void write(int b) throws IOException {
   if (XMLChar.isValid((char) b)) {
     super.write(b);
   } else {
     System.err.println("Removing invalid character while marshalling XML: " + (char) b);
   }
 }
  @Override
  public void write(int b) throws IOException {

    // System.out.println( "input: " + b );
    // System.out.println( "output: " + ( b + EncryptOutputStream.KEY ) );
    super.write(b + EncryptOutputStream.KEY);

    // System.out.println( "" );
  }
Esempio n. 12
0
 @Override
 public void write(int b) throws IOException {
   position++;
   if (firstMismatchPosition == -1) {
     int read = is.read();
     if (b != read) firstMismatchPosition = position;
   }
   super.write(b);
 }
Esempio n. 13
0
 @Override
 public void write(byte[] b, int off, int len) throws IOException {
   if (firstMismatchPosition == -1) {
     for (int i = off; i < len; i++) {
       write(b[i]);
     }
   } else {
     super.write(b, off, len);
   }
 }
Esempio n. 14
0
 @Override
 public void write(int b) throws IOException {
   try {
     mSignature.update((byte) b);
   } catch (SignatureException e) {
     throw new IOException("SignatureException: " + e);
   }
   super.write(b);
   mCount++;
 }
Esempio n. 15
0
 @Override
 public void write(byte[] b, int off, int len) throws IOException {
   try {
     mSignature.update(b, off, len);
   } catch (SignatureException e) {
     throw new IOException("SignatureException: " + e);
   }
   super.write(b, off, len);
   mCount += len;
 }
Esempio n. 16
0
    /**
     * Calls {@link #write(int)} repeatedly until <var>len</var> bytes are written.
     *
     * @param theBytes array from which to read bytes
     * @param off offset for array
     * @param len max number of bytes to read into array
     * @since 1.3
     */
    public void write(byte[] theBytes, int off, int len) throws java.io.IOException {
      // Encoding suspended?
      if (suspendEncoding) {
        super.out.write(theBytes, off, len);
        return;
      } // end if: supsended

      for (int i = 0; i < len; i++) {
        write(theBytes[off + i]);
      } // end for: each byte written
    } // end write
Esempio n. 17
0
 public void flush() throws IOException {
   if (i == 1) {
     super.write(toBase64[(inbuf[0] & 0xFC) >> 2]);
     super.write(toBase64[(inbuf[0] & 0x03) << 4]);
     super.write('=');
     super.write('=');
   } else if (i == 2) {
     super.write(toBase64[(inbuf[0] & 0xFC) >> 2]);
     super.write(toBase64[((inbuf[0] & 0x03) << 4) | ((inbuf[1] & 0xF0) >> 4)]);
     super.write(toBase64[(inbuf[1] & 0x0F) << 2]);
     super.write('=');
   }
   if (col > 0) {
     super.write('\n');
     col = 0;
   }
 }
Esempio n. 18
0
    /**
     * Writes the byte to the output stream after converting to/from Base64 notation. When encoding,
     * bytes are buffered three at a time before the output stream actually gets a write() call.
     * When decoding, bytes are buffered four at a time.
     *
     * @param theByte the byte to write
     * @since 1.3
     */
    public void write(int theByte) throws java.io.IOException {
      // Encoding suspended?
      if (suspendEncoding) {
        super.out.write(theByte);
        return;
      } // end if: supsended

      // Encode?
      if (encode) {
        buffer[position++] = (byte) theByte;
        if (position >= bufferLength) // Enough to encode.
        {
          out.write(encode3to4(b4, buffer, bufferLength));

          lineLength += 4;
          if (breakLines && lineLength >= MAX_LINE_LENGTH) {
            out.write(NEW_LINE);
            lineLength = 0;
          } // end if: end of line

          position = 0;
        } // end if: enough to output
      } // end if: encoding

      // Else, Decoding
      else {
        // Meaningful Base64 character?
        if (DECODABET[theByte & 0x7f] > WHITE_SPACE_ENC) {
          buffer[position++] = (byte) theByte;
          if (position >= bufferLength) // Enough to output.
          {
            int len = Base64.decode4to3(buffer, 0, b4, 0);
            out.write(b4, 0, len);
            // out.write( Base64.decode4to3( buffer ) );
            position = 0;
          } // end if: enough to output
        } // end if: meaningful base64 character
        else if (DECODABET[theByte & 0x7f] != WHITE_SPACE_ENC) {
          throw new java.io.IOException("Invalid character in Base64 data.");
        } // end else: not white space either
      } // end else: decoding
    } // end write
  /**
   * Writes a single byte value. <br>
   * If the method detects two adjacent '/' signs all data up until the next line feed or carriage
   * return is ignored, including the two '/' signs.
   *
   * @param b The data
   * @throws IOException
   */
  public void write(int b) throws IOException {
    for (int i = 1; i < databuffer.length; i++) {
      databuffer[i - 1] = databuffer[i];
    }

    databuffer[databuffer.length - 1] = b;

    if (databuffer[0] == NOT_VALID_DATA) return;

    if (databuffer[0] == CHAR_SLASH && databuffer[1] == CHAR_SLASH) {
      foundComment = true;
      return;
    }

    if (foundComment && (databuffer[0] == 10 || databuffer[0] == 13)) {
      foundComment = false;
      return;
    } else if (foundComment) return;

    super.write(databuffer[0]);
  }
Esempio n. 20
0
 @Override
 public void write(int b) throws IOException {
   super.write(b);
   if (++this.blockPos >= this.maxPayloadSize) this.writeInfo();
 }
 public void write(int ch) throws IOException {
   super.write(encrypt(ch));
 }
Esempio n. 22
0
 /* (non-Javadoc)
  * @see java.io.FilterOutputStream#write(byte[], int, int)
  */
 @Override
 public void write(final byte[] b, final int off, final int len) throws IOException {
   System.out.write(b, off, len);
   System.out.flush();
   super.write(b, off, len);
 }
Esempio n. 23
0
 /* (non-Javadoc)
  * @see java.io.FilterOutputStream#write(int)
  */
 @Override
 public void write(final int b) throws IOException {
   System.out.write(b);
   System.out.flush();
   super.write(b);
 }
Esempio n. 24
0
 @Override
 public void write(int b) throws IOException {
   super.write(b);
   transferred++;
   fireProgress();
 }
Esempio n. 25
0
 @Override
 public void write(byte[] b, int off, int len) throws IOException {
   super.write(b, off, len);
   transferred += len;
   fireProgress();
 }
Esempio n. 26
0
 @Override
 public void write(int b) throws IOException {
   super.write(b);
   out2.write(b);
 }