Package javax.microedition.io.file

Examples of javax.microedition.io.file.FileConnection.fileSize()


          String startBoundary = getStartBoundary(_fileKey, fc.getName(), _mimeType);
          String endBoundary = getEndBoundary();
         
          String params = (_params != null) ? getParameters(_params) : "";
         
          long fileSize = fc.fileSize();
          long contentLength = fileSize +
                  (long)startBoundary.length() +
                  (long)endBoundary.length() +
                  (long)params.length();
       
View Full Code Here


    public StoredFileInfo getFileInfo(final String fileName) throws IOException {
        final StoredFileInfo result = new StoredFileInfo();
        final FileConnection conn = (FileConnection) Connector.open(rootPrefix + fileName);
        try {
            if (conn.exists()) {
                result.fileLength = conn.fileSize();
                final InputStream in = conn.openInputStream();
                try {
                    final byte[] data = BaseStorage.readFromInputStream(in);
                    result.fileCRC = CRC32.calculate(data);
                } finally {
View Full Code Here

                    try {
                        if (options.replayMode) {
                            inputStream = Connector.openInputStream(options.replayFileName);
                            FileConnection conn = (FileConnection) Connector.open(options.replayFileName,
                                    Connector.READ);
                            gpsState.replySize = conn.fileSize();
                            gpsState.replyPosition = 0;
                            conn.close();
                        } else {
                            inputStream = Connector.openInputStream(options.gpsUrl);
                        }
View Full Code Here

        }

        String name = con.getName();
        String mimeType = MIMETypeAssociations.getMIMEType( name );

        int size = (int) con.fileSize();
        byte[] data = new byte[ size ];
        DataInputStream dis = con.openDataInputStream();
        dis.read( data, 0, size );
        close( dis );
        close( con );
View Full Code Here

     * is 16bit 8000hz mono
     */
    private void writeWavHeader() throws IOException {
        // Reopen the output file
        FileConnection conn = (FileConnection) Connector.open( _path, Connector.READ_WRITE );
        int size = (int) conn.fileSize();

        // use output stream as it is shown in the sample
        OutputStream o = conn.openOutputStream();

        //*********************************************************************************************************************
 
View Full Code Here

            props.addCommand(backToBCommand);
            props.setCommandListener(this);

            props.append(new StringItem(T._("Location"), currDirName));
            props.append(new StringItem(T._("Type"), fc.isDirectory() ? T._("Directory") : T._("Regular File")));
            props.append(new StringItem(T._("Size"), Long.toString((fc.isDirectory() ? fc.directorySize(true) : fc.fileSize()))));
            props.append(new StringItem(T._("Modified"), myDate(fc.lastModified())));

            ChoiceGroup attrs = new ChoiceGroup(T._("Attributes"), Choice.MULTIPLE, attrList, null);
            attrs.setSelectedFlags(new boolean[] { fc.canRead(), fc.canWrite(), fc.isHidden() });
            props.append(attrs);
View Full Code Here

            props.addCommand(backToBCommand);
            props.setCommandListener(this);

            props.append(new StringItem(T._("Location"), currDirName));
            props.append(new StringItem(T._("Type"), fc.isDirectory() ? T._("Directory") : T._("Regular File")));
            props.append(new StringItem(T._("Size"), Long.toString((fc.isDirectory() ? fc.directorySize(true) : fc.fileSize()))));
            props.append(new StringItem(T._("Modified"), myDate(fc.lastModified())));

            ChoiceGroup attrs = new ChoiceGroup(T._("Attributes"), Choice.MULTIPLE, attrList, null);
            attrs.setSelectedFlags(new boolean[] { fc.canRead(), fc.canWrite(), fc.isHidden() });
            props.append(attrs);
View Full Code Here

            props.addCommand(backToBCommand);
            props.setCommandListener(this);

            props.append(new StringItem(T._("Location"), currDirName));
            props.append(new StringItem(T._("Type"), fc.isDirectory() ? T._("Directory") : T._("Regular File")));
            props.append(new StringItem(T._("Size"), Long.toString((fc.isDirectory() ? fc.directorySize(true) : fc.fileSize()))));
            props.append(new StringItem(T._("Modified"), myDate(fc.lastModified())));

            ChoiceGroup attrs = new ChoiceGroup(T._("Attributes"), Choice.MULTIPLE, attrList, null);
            attrs.setSelectedFlags(new boolean[] { fc.canRead(), fc.canWrite(), fc.isHidden() });
            props.append(attrs);
View Full Code Here

     */
    private byte[] getData(final String url) {
        byte[] data = new byte[0];
        try {
            final FileConnection file = (FileConnection) Connector.open(url);
            final int fileSize = (int) file.fileSize();
            data = new byte[fileSize];
            final InputStream inputStream = file.openInputStream();
            inputStream.read(data);
        } catch (final Exception e) {
            errorDialog(e.toString());
View Full Code Here

     */
    public VideoPlaybackScreen(final String file) {
        boolean notEmpty;
        try {
            final FileConnection fconn = (FileConnection) Connector.open(file);
            notEmpty = fconn.exists() && fconn.fileSize() > 0;
            fconn.close();
        } catch (final IOException e) {
            Dialog.alert("Exception while accessing the video filesize:\n\n"
                    + e);
            notEmpty = false;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.