274 } |
275 } |
275 print("m"); |
276 print("m"); |
276 } |
277 } |
277 } |
278 } |
278 |
279 |
|
280 /** |
|
281 * Colors can be switched on/off during usage of this writer. |
|
282 * |
|
283 * @return whether colors are currently turned on |
|
284 * @see #isColorEnabled() |
|
285 */ |
279 public boolean isColorful() { |
286 public boolean isColorful() { |
280 return colorful; |
287 return colorful; |
281 } |
288 } |
282 |
289 |
|
290 /** |
|
291 * Collors might be definitively disabled in constructor. If not, they can be turned on/off |
|
292 * during usage of this writer by {@linkplain #setColorful(boolean)} |
|
293 * |
|
294 * @return whether colors are allowed for this instance of this class |
|
295 * @see #isColorful() |
|
296 */ |
|
297 public boolean isColorEnabled() { |
|
298 return COLOR_ENABLED; |
|
299 } |
|
300 |
|
301 /** |
|
302 * @see #isColorful() |
|
303 * @see #isColorEnabled() |
|
304 */ |
283 public void setColorful(boolean colorful) { |
305 public void setColorful(boolean colorful) { |
284 this.colorful = colorful; |
306 this.colorful = colorful; |
285 } |
307 } |
286 |
308 |
287 public ColorfulPrintWriter(File file) throws FileNotFoundException { |
309 public ColorfulPrintWriter(File file) throws FileNotFoundException { |
288 super(file); |
310 super(file); |
|
311 COLOR_ENABLED = true; |
289 } |
312 } |
290 |
313 |
291 public ColorfulPrintWriter(OutputStream out) { |
314 public ColorfulPrintWriter(OutputStream out) { |
292 super(out); |
315 super(out); |
|
316 COLOR_ENABLED = true; |
293 } |
317 } |
294 |
318 |
295 public ColorfulPrintWriter(String fileName) throws FileNotFoundException { |
319 public ColorfulPrintWriter(String fileName) throws FileNotFoundException { |
296 super(fileName); |
320 super(fileName); |
|
321 COLOR_ENABLED = true; |
297 } |
322 } |
298 |
323 |
299 public ColorfulPrintWriter(Writer out) { |
324 public ColorfulPrintWriter(Writer out) { |
300 super(out); |
325 super(out); |
|
326 COLOR_ENABLED = true; |
301 } |
327 } |
302 |
328 |
303 public ColorfulPrintWriter(File file, String csn) throws FileNotFoundException, UnsupportedEncodingException { |
329 public ColorfulPrintWriter(File file, String csn) throws FileNotFoundException, UnsupportedEncodingException { |
304 super(file, csn); |
330 super(file, csn); |
305 } |
331 COLOR_ENABLED = true; |
306 |
332 } |
307 public ColorfulPrintWriter(OutputStream out, boolean autoFlush) { |
333 |
|
334 /** |
|
335 * @param colorEnabled colors might be definitively disabled by this option – this might be more |
|
336 * optimalizable than dynamic turning off colors by {@linkplain #setColorful(boolean)} which is |
|
337 * not definitive (colors can be turned on during live of this instance). This might be useful |
|
338 * if you need an instance of this class but don't need colors at all. |
|
339 */ |
|
340 public ColorfulPrintWriter(OutputStream out, boolean autoFlush, boolean colorEnabled) { |
308 super(out, autoFlush); |
341 super(out, autoFlush); |
|
342 COLOR_ENABLED = colorEnabled; |
309 } |
343 } |
310 |
344 |
311 public ColorfulPrintWriter(String fileName, String csn) throws FileNotFoundException, UnsupportedEncodingException { |
345 public ColorfulPrintWriter(String fileName, String csn) throws FileNotFoundException, UnsupportedEncodingException { |
312 super(fileName, csn); |
346 super(fileName, csn); |
|
347 COLOR_ENABLED = true; |
313 } |
348 } |
314 |
349 |
315 public ColorfulPrintWriter(Writer out, boolean autoFlush) { |
350 public ColorfulPrintWriter(Writer out, boolean autoFlush) { |
316 super(out, autoFlush); |
351 super(out, autoFlush); |
|
352 COLOR_ENABLED = true; |
317 } |
353 } |
318 } |
354 } |