How to write a (g)zip file to disk using NIO

Hi,
I want to write some data to a zipped file. I have all data to write to disk in ByteBuffer objects so I want to use NIO. The GZIPOutputstream does not have a getChannel() method. So what is the best method to zip data to file?
Any comments are welcome!!
Uli

Sorry, wrong ByteBuffer in my claspath.
So why don't you copy the bytes out of it using the get(byte[], int, int) ?

Similar Messages

  • How to store crystal report (rpt file) into disk using java

    hello
    i want to coonect my report file to java .want convert this file into pdf and store into disk using simple java program
    if any have code for this then provide me
    thanks & regards
    ram

    Have you given up on your other threads? All your questions seem to be on the same general problem. Could you please stop creating new threads for this?

  • How to write to a log file within a JSP

    Hello everybody,
    do you know how to write to a log file within a JSP.
    my code is (/space/SP/tlf/ExcepcionJava.jsp):
    <html>
    <body bgColor=#C4E1FF>
    <%@ page import="java.io.*" %>
    <%
         FileWriter salida = new FileWriter(response.encodeURL("log.txt"));
         salida.write(request.getParameter("errorMsg"));
         salida.close();
    %>
    </body>
    </html>.. I run under Solaris, Jrun 2.3.3
    I have also test with getServletContext().getRealPath(), but I get /netsrv/nes/docs/ instead of /space/SP/tlf/

    Hi,
    Give the full path of the log file to the FileWriter. Such as;
    FileWriter salida = new FileWriter(response.encodeURL("/usr/local/tomcat/logs/testlogs/log.txt"));
    nurettin

  • How to write a Xml installation file to build  web installer using IzPack.

    Hai everyone,
    I have got a problem in building a web installer using IzPack.I am getting this exception,when I am compiling my install.xml using a compile tool provided by IzPack soft.Eventhough I have not mentioned "packsinfo.xml" in my Xml installation file.
    Fatal error :
    null\packsinfo.xml (The system cannot find the path specified)
    java.io.FileNotFoundException: null\packsinfo.xml (The system cannot find the path specified)
    What went wrong??
    It is very very urgent. Could anyone tell me how to write a Xml installation file for building web installer,please??
    any help will be highly appreciated....
    Thank you very much in advance

    Hi,
    that is not really a java related question. Have you tried to find some IzPack support forum? I've never heard about it, so I can't help.

  • How to write data to text file using external tables

    can anybody tell how to write data to text file using external tables concept?

    Hi,
    Using external table u can load the data in your local table in database,
    then using your local db table and UTL_FILE pacakge u can wrrite data to text file
    external table
    ~~~~~~~~~~~
    http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_7002.htm#i2153251
    UTL_FILE
    ~~~~~~~~~
    http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_file.htm#sthref14093
    Message was edited by:
    Nicloei W
    Message was edited by:
    Nicloei W

  • How to write code for save file directory?

    how to write code for save file directory?

    how to find usa timezone code using java swing?
    i have some code help me
    public class ItsInitializer {
    private static boolean s_initialized = false;
    private ItsInitializer() {
    public static synchronized void initialize() {
    if (!s_initialized) {
    // Modifies default time zone, disables Daylight Saving Time.
    TimeZone l_defaultTimeZone = TimeZone.getDefault();
    int l_rawOffset = l_defaultTimeZone.getRawOffset();
    String l_id = l_defaultTimeZone.getID();
    SimpleTimeZone l_simpleTimeZone = new SimpleTimeZone(l_rawOffset,
    l_id,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0);
    TimeZone.setDefault(l_simpleTimeZone);
    s_initialized = true;
    2.
    long timeMillis = ...;
    long time = timeMillis / 1000;
    String seconds = Integer.toString((int)(time % 60));
    String minutes = Integer.toString((int)((time % 3600) / 60));
    String hours = Integer.toString((int)(time / 3600));
    for (int i = 0; i < 2; i++) {
         if (seconds.length() < 2) {
              seconds = "0" + seconds;
         if (minutes.length() < 2) {
              minutes = "0" + minutes;
         if (hours.length() < 2) {
              hours = "0" + hours;
    3.
    import java.text.SimpleDateFormat;
    import java.util.Date;
    public class Convert {
    public String getDateTime(String pattern){
    SimpleDateFormat sdf = new SimpleDateFormat(pattern);
    return sdf.format(new Date());
    * @param args
    public static void main(String[] args) {
    Convert con = new Convert();
    System.out.println(con.getDateTime("hh:mm:ss"));
    5.import java.text.SimpleDateFormat;
    import java.util.Date;
    public class Convert {
    public String getDateTime(String pattern){
    SimpleDateFormat sdf = new SimpleDateFormat(pattern);
    return sdf.format(new Date());
    * @param args
    public static void main(String[] args) {
    Convert con = new Convert();
    System.out.println(con.getDateTime("hh:mm:ss"));
    [ November 23, 2005: Mess
    private Locale locale = Locale.US;
    private static final String[] tzStrings = {
    "America/New_York",
    "America/Chicago",
    "America/Denver",
    "America/Los_Angeles",
    Date now = new Date();
    for ( TimeZone z : zones) {
    DateFormat df = new SimpleDateFormat("K:mm a,z", locale);
    df.setTimeZone(z);
    String result = df.format(now);
    System.out.println(result);
    String date="05/19/2008 04:30 AM (EST)";
                   SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy hh:mm aaa (z)");
                   TimeZone.setDefault(TimeZone.getTimeZone("PST"));
                   long millis = sdf.parse(date).getTime();
                   sdf.setTimeZone(TimeZone.getDefault());
                   System.out.println(sdf.format(new Date(millis)));
    [ November 23, 2005: Mes                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to create a split zip file?

    Hi,
    Does anybody know how to create a split zip file using only Java?
    Lets say I have a file that compressed has a size of 10MB and I need to split it into small files of 1MB each... and then be able to open and uncompress it using winzip or any other compressing tool.
    I know how to create a zip file using java.util.zip but I cannot split it...
    Thanks,
    Ignacio

    IgnacioKriche wrote:
    Thanks for the philosophical advice...
    Can anyone help me? Does anyone know if Java API java.util.zip can split a zip file?I'm 99.9 % sure that there is nothing in the Java ZIP APIs to do this but I'm 100% sure I can't be certain.

  • PI needs to obtain a zip file via FTP using the File adapter

    I have a scenario where PI needs to obtain a zip file via FTP using the File adapter, this zip file contains a number of txt files that I need to process, and the content of one of them send it to an ECC, now I'm using the PayloadZipBean Module in the Sender FIle Adapter, and I have two things if I use the Message Protocol as File, I get a Payload for each txt file in the zip file, but this payload has no structure, and if I use the File Content Conversion I get an XML strcuture with only one field and a strange string in it, and somewhere in this string the names of the files I assume all the content of the zip file, can anyone help on how could I achieve what I need that is to pull the zip file via SAP PI, then unzip it, and with the content of one of the txt files send it to an ECC via ABAP Proxy, thanks in advance for your answers.
    Regards,
    Raul Alvarado

    Hello Raul,
    you can do it in futher way ...
    pickup zip file and simply extract and dump it in another temp folder (can use scripts on OS level).
    @ then Use another sender communication channel to pickup all these text file .
    for further clarification you can use these links also. -
    Process txt files in zip file
    Accessing File using FTP from Java Mapping
    File Sender Adapter with FTP protocol
    BR
    Raj

  • How do I view ipod music files with out using I tunes?

    I trying to view my Ipod music files without using itunes. But when I conect my Ipod to my pc I can only view contacts, notes, and caladar through the driver.
    How do I view ipod music files with out using I tunes?

    they should be under ur my music folder if u have windows

  • Q: How do I convert a pdf file to Word using Adobe Export PDF? - all my attempts are scrambled.

    Q: How do I convert a pdf file to Word using Acrobat Export PDF - all my attempts are scrambled

    Do you subscribe an Adobe Export PDF account? If you do not have an account, please go to https://www.acrobat.com/exportpdf/en/home.html?trackingid=JPZKN to subscribe.
    If you have an account, make sure verify your email address and sign in from https://exportpdf.acrobat.com/SignIn.html
    Jyh-Jiun Liou

  • How do I upload an XML file to salesforce using BULK API?

    Hi There,
    Please let me know how do we upload an XML file to salesforce using Bulk API?
    Thanks,
    ET

    Hi,
    I think that this is a more SalesForce.com question and think you will have more chance looking at SOAP API Developer's Guide for salesforce. Sending a SOAP request from the API Server is very straight forward and there are several tutorials and well documented about this.
    Cheers,
    Stefan

  • HOW TO READ AND OPEN Zip files IN MAIL?

    Anyone know how to open and read attached zip-files in iPhone 3G mail?
    Thanks in advance,
    Alessio

    Hi Alessio,
    The iPhone does not support reading or uncompressing .zip files.
    +Mail attachment support+
    +Viewable document types: .jpg, .tiff, .gif (images); .doc and .docx (Microsoft Word); .htm and .html (web pages); .key (Keynote); .numbers (Numbers); .pages (Pages); .pdf (Preview and Adobe Acrobat); .ppt and .pptx (Microsoft PowerPoint); .txt (text); .vcf (contact information); .xls and .xlsx (Microsoft Excel)+
    http://www.apple.com/iphone/specs.html
    Jason

  • How can i create a zip-file with multiple volumes

    Hi,
    i've to zip a large file (250 MB and more). But the zip file shouldn't be greater than 5 MB, because i have to send the file via E-Mail. So i've thought, that the solution of this problem can be to zip the large file in smaller zip-files, which are multiple volumes of a zip-archive. I've searched very long in WWW, but didn't find something. Perhaps you can help.
    Sorry, about the bad english. :-)
    Timo Bunger

    Hi
    Who said your english is bad ?. OK, are you looking for compressing the 250 MB file in to multiple versions using a java program ?. If not, there is a shareware you can download and split the file into multiple parts by specifying size of each part. You can send these parts via email and the other person can combine these parts into a single file again.
    Find this @
    http://www.freedownloadscenter.com/Utilities/File_Splitting_Utilities/EzSplit.html
    You may need to read a bit about it on how to use.
    Thanks
    Srinivas

  • Anyone know how to write to a RAW file format?

    Hello,
    Been trying to find out if there is any way to write a RAW format file from an array containing pixel values? Do I just use a file writer and save as *.raw?
    Also, what information must I include beyond the pixel values?
    Thanks!

    Well, I had found those already and they weren't of
    too much help to my problem (how to actually create
    the RAW file), but thanks.I'd imagine that you'd create the RAW file according to the specifications provided. The links provided give you information as to the format of the RAW file. In order to actually create the RAW file, you'd simply spit out the properly-formed data to a file (see a tutorial such as "Lesson: I/O: Reading and Writing (but no 'rithmetic)" for more info, if needed).
    What additional help are you looking for?

  • How to insert and retrieve zip files in to blob column in oracle database?

    Hi All,
    I have a requirement where i need to insert zip files to BLOB and retrieve them.
    Please suggest me any good example or redirect me to them.

    You already have a post on this subject here: read and write compressed data from blob in ADF
    Please do not post duplicate questions.

Maybe you are looking for

  • Custom Report LayOut in BI Publisher

    I have uploaded an xml file to the word plugin in order to make a report layout. I have inserted all the fields in one line. When I preview the report it shows only one line and not all data. What may be cause of the problem?

  • Solaris zones with whole root

    Hi, i was trying to configure a solaris whole root zone, but when i try to install , it gave an error , sanity check error. solaris# zonecfg -z solaris8 solaris8: No such zone configured Use 'create' to begin configuring a new zone. zonecfg:solaris8-

  • Which Sourcesystem client needs to be selected?

    Dear All, I have a question regarding choosing the right client. I have to extract data from IS-U system into BW. An IS-U Dev System has three clients. 1) Golden Client (100) 2) Development (200) 3) Sand Box (300) Similarly BW Dev System has followin

  • How to add contents of hashset to file?

    guys, i need to write hashset data to file.. here is my code: HashSet<String> hs = new HashSet<String>(); File outfile3= new File("C:\\test.txt");            FileWriter of3 = (new FileWriter(outfile3));                Iterator it = hs.iterator();    

  • Flash and local based Search

    Hi Community, We have to build search functionality that can easily adapt from a CD-based local search system to a web-based, server driven search system. Any pointers on the best approach? What options are out there for building local search in Flas