Code example for OutputStreamWriter

Methods: flush, write

0
            super(TEXT_PLAIN); 
        } 
 
        @Override 
        public void write(OutputStream outputStream) throws IOException {
            Writer writer = new OutputStreamWriter(outputStream);
            DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.DEFAULT,
                    DateFormat.SHORT, Locale.getDefault());
          //TODO This is formating the datetime with server locale need to send page locale in URL 
            writer.write(dateFormat.format(new Date()));
            writer.flush();
        } 
    } 
 
}