Example usage for java.lang System err

List of usage examples for java.lang System err

Introduction

In this page you can find the example usage for java.lang System err.

Prototype

PrintStream err

To view the source code for java.lang System err.

Click Source Link

Document

The "standard" error output stream.

Usage

From source file:NewPageChunkNEXTPAGEPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {// www.  j a  va2  s  .  com
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("NewPageChunkNEXTPAGEPDF.pdf"));
        document.open();

        document.add(new Paragraph("A"));
        document.newPage();
        document.add(new Paragraph("B"));
        document.newPage();
        document.add(Chunk.NEXTPAGE);
        document.add(new Paragraph("C"));
    } catch (Exception ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:PdfVersion1_3.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*  ww  w  .ja va  2 s  .  co  m*/
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("PDFversion1_3.pdf"));
        writer.setPdfVersion(PdfWriter.VERSION_1_3);
        //writer.setPdfVersion(PdfWriter.VERSION_1_4);
        //writer.setPdfVersion(PdfWriter.VERSION_1_5);
        //writer.setPdfVersion(PdfWriter.VERSION_1_6);
        document.open();
        document.add(new Paragraph("This is a PDF-1.3 document"));
    } catch (Exception ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:FillCirclesPDF.java

public static void main(String[] args) {
    Document document = new Document();

    try {//  w  w  w  .  ja v a2s.  c om
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("FillCirclesPDF.pdf"));
        document.open();

        PdfContentByte cb = writer.getDirectContent();

        cb.setRGBColorFill(0xFF, 0x00, 0x00);
        cb.circle(250.0f, 500.0f, 200.0f);
        cb.circle(250.0f, 500.0f, 150.0f);
        cb.circle(350.0f, 300.0f, 150.0f);

        cb.fillStroke();

    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:MainClass.java

public static void main(String[] args) {
    String phrase = new String("text \n");
    String dirname = "C:/test";
    String filename = "charData.txt";
    File dir = new File(dirname);
    File aFile = new File(dir, filename);
    FileOutputStream outputFile = null;
    try {//from w  ww.  ja v  a  2s . com
        outputFile = new FileOutputStream(aFile, true);
        System.out.println("File stream created successfully.");
    } catch (FileNotFoundException e) {
        e.printStackTrace(System.err);
    }
    FileChannel outChannel = outputFile.getChannel();
    ByteBuffer buf = ByteBuffer.allocate(1024);
    System.out.println("New buffer:           position = " + buf.position() + "\tLimit = " + buf.limit()
            + "\tcapacity = " + buf.capacity());
    for (char ch : phrase.toCharArray()) {
        buf.putChar(ch);
    }
    System.out.println("Buffer after loading: position = " + buf.position() + "\tLimit = " + buf.limit()
            + "\tcapacity = " + buf.capacity());
    buf.flip();
    System.out.println("Buffer after flip:   position = " + buf.position() + "\tLimit = " + buf.limit()
            + "\tcapacity = " + buf.capacity());
    try {
        outChannel.write(buf);
        outputFile.close();
        System.out.println("Buffer contents written to file.");
    } catch (IOException e) {
        e.printStackTrace(System.err);
    }
}

From source file:AddingParagraphToAPagePDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {//from  www  .  j av  a 2  s.  co m
        PdfWriter.getInstance(document, new FileOutputStream("AddingParagraphToAPagePDF.pdf"));
        document.open();
        document.add(new Paragraph("First Page."));
        document.setPageSize(PageSize.A3);
        document.newPage();
        document.add(new Paragraph("This PageSize is A3."));
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:CreatingANewPagePDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {//from  w w w.ja v  a 2s . c  o m
        PdfWriter.getInstance(document, new FileOutputStream("CreatingANewPagePDF.pdf"));
        document.open();
        document.add(new Paragraph("First Page."));
        document.setPageSize(PageSize.A3);
        document.newPage();
        document.add(new Paragraph("This PageSize is A3."));
    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    } catch (IOException ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:NewPageToStartANewPagePDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*from w  ww  .java  2s  . c o m*/
        PdfWriter.getInstance(document, new FileOutputStream("NewPageToStartANewPagePDF.pdf"));
        document.open();

        document.add(new Paragraph("A"));
        document.newPage();
        document.add(new Paragraph("B"));
        document.newPage();
        document.newPage();
        document.newPage();
        document.add(new Paragraph("C"));
    } catch (Exception ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:com.threerings.getdown.tools.AppletParamSigner.java

public static void main(String[] args) {
    try {//from   w  ww .j  a  v a 2 s.c o m
        if (args.length != 7) {
            System.err
                    .println("AppletParamSigner keystore storepass alias keypass " + "appbase appname imgpath");
            System.exit(255);
        }

        String keystore = args[0];
        String storepass = args[1];
        String alias = args[2];
        String keypass = args[3];
        String appbase = args[4];
        String appname = args[5];
        String imgpath = args[6];
        String params = appbase + appname + imgpath;

        KeyStore store = KeyStore.getInstance("JKS");
        store.load(new BufferedInputStream(new FileInputStream(keystore)), storepass.toCharArray());
        PrivateKey key = (PrivateKey) store.getKey(alias, keypass.toCharArray());
        Signature sig = Signature.getInstance("SHA1withRSA");
        sig.initSign(key);
        sig.update(params.getBytes());
        String signed = new String(Base64.encodeBase64(sig.sign()));
        System.out.println("<param name=\"appbase\" value=\"" + appbase + "\" />");
        System.out.println("<param name=\"appname\" value=\"" + appname + "\" />");
        System.out.println("<param name=\"bgimage\" value=\"" + imgpath + "\" />");
        System.out.println("<param name=\"signature\" value=\"" + signed + "\" />");

    } catch (Exception e) {
        System.err.println("Failed to produce signature.");
        e.printStackTrace();
    }
}

From source file:Main.java

public static void main(String[] args) {

    Path basedir = FileSystems.getDefault().getPath("C:/tutorial/tmp");
    String tmp_file_prefix = "Swing_";
    String tmp_file_sufix = ".txt";

    //get the default temporary folders path
    String default_tmp = System.getProperty("java.io.tmpdir");
    System.out.println(default_tmp);

    try {/*w w  w . j a  va  2 s.co  m*/
        //create a tmp file in a the base dir
        Path tmp_3 = Files.createTempFile(basedir, tmp_file_prefix, tmp_file_sufix);
        System.out.println("TMP: " + tmp_3.toString());

    } catch (IOException e) {
        System.err.println(e);
    }
}

From source file:UDPTimeServer.java

public static void main(String[] args) throws IOException {

    int port = 37;

    ByteBuffer in = ByteBuffer.allocate(8192);
    ByteBuffer out = ByteBuffer.allocate(8);
    out.order(ByteOrder.BIG_ENDIAN);
    SocketAddress address = new InetSocketAddress(port);
    DatagramChannel channel = DatagramChannel.open();
    DatagramSocket socket = channel.socket();
    socket.bind(address);//from w  ww . j  av  a 2s .  c o m
    System.err.println("bound to " + address);
    while (true) {
        try {
            in.clear();
            SocketAddress client = channel.receive(in);
            System.err.println(client);
            long secondsSince1970 = System.currentTimeMillis();
            out.clear();
            out.putLong(secondsSince1970);
            out.flip();

            out.position(4);
            channel.send(out, client);
        } catch (Exception ex) {
            System.err.println(ex);
        }
    }
}