Package java.io

Examples of java.io.FilterOutputStream


      RandomAccessFile raf = null;
      PrintStream ps = System.out;
      if (args.length == 3) {  // input file, output file, get data for dump
        raf = new RandomAccessFile(args[0], "r");
        ps = new PrintStream(
                new FilterOutputStream(
                        new FileOutputStream(args[1], false)));
        displayData = args[2].equalsIgnoreCase("true");
      } else if (args.length == 2) {  // input file and output file for dump
        raf = new RandomAccessFile(args[0], "r");
        if (args[1].equalsIgnoreCase("true")
                || args[1].equalsIgnoreCase("false")) {
          displayData = args[1].equalsIgnoreCase("true");
        } else {
          ps = new PrintStream(
                  new FilterOutputStream(
                          new FileOutputStream(args[1], false)));
        }
      } else if (args.length == 1) {
        raf = new RandomAccessFile(args[0], "r");
      } else {
View Full Code Here


    // need a quiet ping so temporarily disable the logwriter
    PrintWriter savWriter = logWriter;
    // DERBY-1571: If logWriter is null, stack traces are printed to
    // System.err. Set logWriter to a silent stream to suppress stack
    // traces too.
    FilterOutputStream silentStream = new FilterOutputStream(null) {
        public void write(int b) { }
        public void flush() { }
        public void close() { }
      };
    setLogWriter(new PrintWriter(silentStream));
View Full Code Here

            readResult();
            savWriter = logWriter;
            // DERBY-1571: If logWriter is null, stack traces are printed to
            // System.err. Set logWriter to a silent stream to suppress stack
            // traces too.
            FilterOutputStream silentStream = new FilterOutputStream(null) {
                public void write(int b) {
                }

                public void flush() {
                }
View Full Code Here

    }

    private static void writeBinary(File outputFile, Printable printable) throws IOException {
        OutputStream outputStream = null;
        if(outputFile == null) {
            outputStream = new FilterOutputStream(System.out) {

                @Override
                public void close() throws IOException {
                    flush();
                }
View Full Code Here

    }

    private static void writeAscii(File outputFile, Writable writable) throws IOException {
        Writer writer = null;
        if(outputFile == null) {
            writer = new OutputStreamWriter(new FilterOutputStream(System.out) {

                @Override
                public void close() throws IOException {
                    flush();
                }
View Full Code Here

               return value;
             }
          }));
      this.out = new DataOutputStream
        (new BufferedOutputStream
         (new FilterOutputStream(socket.getOutputStream()) {
             public void write(byte[] buf, int o, int len) throws IOException {
               out.write(buf, o, len);
               if (writingCall != null) {
                 writingCall.touch();
               }
View Full Code Here

     * @return
     */
    OutputStream writeChecksummedTo(final long fileOffset, final int length) {
        final ByteArrayOutputStream baos = new ByteArrayOutputStream(length);
        OutputStream cos = checksumOutputStream(baos);
        return new FilterOutputStream(cos) {
           
            public void close() throws IOException {
                out.close();
                byte[] buf = baos.toByteArray();
                if(buf.length != length)
View Full Code Here

     * @return
     */
    OutputStream writeChecksummedTo(final long fileOffset, final int length) {
        final ByteArrayOutputStream baos = new ByteArrayOutputStream(length);
        OutputStream cos = checker.checksumWriter(baos);
        return new FilterOutputStream(cos) {

            public void close() throws IOException {
                out.close();
                byte[] buf = baos.toByteArray();
                if (buf.length != length)
View Full Code Here

  **
  ** The {@code write} methods will throw {@link IOException} if bytes
  ** different from the header are written.
  */
  public static OutputStream dimOutput(final byte[] hd, OutputStream s) {
    return new FilterOutputStream(s) {
      private int i = 0;

      @Override public void write(int b) throws IOException {
        if (i < hd.length) {
          if ((byte)b != hd[i]) { throw new IOException("byte " + i + ": expected '" + hd[i] + "'; got '" + b + "'."); }
View Full Code Here

      consume(remoteErr);
      remoteIn.write(CMD_UNBUNDLE.getBytes());
      remoteIn.write('\n');
      writeParameters(Collections.singletonList(new Parameter("heads", l)));
      checkError();
      return new FilterOutputStream(remoteIn) {
        @Override
        public void close() throws IOException {
          out.flush();
          @SuppressWarnings("unused")
          int responseLen = readResponseLength();
View Full Code Here

TOP

Related Classes of java.io.FilterOutputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.