Example usage for java.io FileOutputStream FileOutputStream

List of usage examples for java.io FileOutputStream FileOutputStream

Introduction

In this page you can find the example usage for java.io FileOutputStream FileOutputStream.

Prototype

public FileOutputStream(FileDescriptor fdObj) 

Source Link

Document

Creates a file output stream to write to the specified file descriptor, which represents an existing connection to an actual file in the file system.

Usage

From source file:MainClass.java

public static void main(String[] args) throws Exception {
    Document document = new Document();
    PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));
    document.open();/*from  ww w.j ava 2s  .co m*/
    List list1 = new List(List.ORDERED, 20);
    list1.add(new ListItem("A"));
    list1.add(new ListItem("B"));
    list1.add(new ListItem("C"));
    document.add(list1);

    document.close();
}

From source file:MainClass.java

public static void main(String[] args) throws Exception {
    Document document = new Document();
    PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));
    document.open();//w  ww.  j  a va 2 s. co m
    document.add(new Paragraph("dog.wmf"));
    Image img1 = Image.getInstance("dog.wmf");
    System.out.println(img1.getClass().getName());
    document.add(img1);

    document.close();
}

From source file:Main.java

public static void main(String[] args) throws IOException {
    short[] s = { -5, 32767 };
    FileOutputStream fos = new FileOutputStream("c:\\test.txt");
    DataOutputStream dos = new DataOutputStream(fos);
    for (short j : s) {
        dos.writeShort(j);/*from w  w w  .  j a va2 s . c  o m*/
    }
    dos.flush();
    InputStream is = new FileInputStream("c:\\test.txt");
    DataInputStream dis = new DataInputStream(is);
    while (dis.available() > 0) {
        int k = dis.readUnsignedShort();
        System.out.print(k);
    }
}

From source file:MainClass.java

public static void main(String[] args) throws Exception {
    Document document = new Document();
    PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));
    document.open();// w  w  w . jav  a2 s  .  c  o  m
    document.add(new Paragraph("dog.png"));
    Image img1 = Image.getInstance("dog.png");
    System.out.println(img1.getClass().getName());
    document.add(img1);

    document.close();
}

From source file:MainClass.java

public static void main(String[] args) throws Exception {
    Document document = new Document();
    PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));
    document.open();/*from w  ww  . j av a  2s  . c  o m*/
    List list1 = new List(List.UNORDERED, 30);
    list1.add(new ListItem("A"));
    list1.add(new ListItem("B"));
    list1.add(new ListItem("C"));
    document.add(list1);

    document.close();
}

From source file:MainClass.java

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

    PdfEncryptor.encrypt(new PdfReader("1.pdf"), new FileOutputStream("Encrypted2.pdf"), "Hello".getBytes(),
            "World".getBytes(), PdfWriter.AllowDegradedPrinting, PdfWriter.STRENGTH128BITS);

    getEncryptionInformation("1.pdf", null);
    getEncryptionInformation("Encrypted2.pdf", "World");
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Pack200.Unpacker unpacker = Pack200.newUnpacker();
    JarOutputStream out = new JarOutputStream(new FileOutputStream("outName"));
    InputStream in = new FileInputStream("inName");
    // in = new GZIPInputStream(in);
    unpacker.unpack(in, out);/*from   w w w  . j  a  va2s .  co m*/
    out.close();
}

From source file:Main.java

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

    FileInputStream fin = new FileInputStream("a.dat");
    InflaterInputStream iis = new InflaterInputStream(fin);
    FileOutputStream fout = new FileOutputStream("b.dat");
    for (int c = iis.read(); c != -1; c = iis.read()) {
        fout.write(c);//from  w  w w  .  j a va  2s.  c om
    }
    fout.close();

}

From source file:MainClass.java

public static void main(String[] args) throws Exception {
    Document document = new Document();
    PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));
    document.open();/*from w  w w  .j  a  v a  2  s  .c o m*/
    Image jpg1 = Image.getInstance("dog.jpg");
    jpg1.scalePercent(80);
    jpg1.setRotation((float) Math.PI / 6);
    document.add(new Paragraph("rotate 30 degrees"));
    document.add(jpg1);
    document.add(new Paragraph("Original width: " + jpg1.width() + "; original height: " + jpg1.height()));
    document.close();
}

From source file:ImageAlignmentPDF.java

public static void main(String[] args) {

    Document document = new Document();
    try {/*from w  ww .  jav  a 2  s .c om*/
        PdfWriter.getInstance(document, new FileOutputStream("ImageAlignmentPDF.pdf"));
        document.open();

        Image imageRight = Image.getInstance("logo.png");
        imageRight.setAlignment(Image.RIGHT);

        Image imageCenter = Image.getInstance("logo.png");
        imageCenter.setAlignment(Image.MIDDLE);

        Image imageLeft = Image.getInstance("logo.png");
        imageLeft.setAlignment(Image.LEFT);

        document.add(imageRight);
        document.add(imageCenter);
        document.add(imageLeft);
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}