Syntax Highlight

Hi guys. I wanted to install a syntax highlighter to make all the code snippets on this forum more readable. It seems the plugin is not yet functional though, and so I’m leaving this thread up mainly as a test-thread for the plugin maker to look at.


//ordinary code
public static void fileCopy( File in, File out )
            throws IOException
    {
        FileChannel inChannel = new FileInputStream( in ).getChannel();
        FileChannel outChannel = new FileOutputStream( out ).getChannel();
        try
        {
//          inChannel.transferTo(0, inChannel.size(), outChannel);      // original -- apparently has trouble copying


Code:
//invalid tag public static void fileCopy( File in, File out )             throws IOException     {         FileChannel inChannel = new FileInputStream( in ).getChannel();         FileChannel outChannel = new FileOutputStream( out ).getChannel();         try         { //          inChannel.transferTo(0, inChannel.size(), outChannel);      // original -- apparently has trouble copying
Code:
//Proper java tag public static void fileCopy( File in, File out )            throws IOException    {        FileChannel inChannel = new FileInputStream( in ).getChannel();        FileChannel outChannel = new FileOutputStream( out ).getChannel();        try        { //          inChannel.transferTo(0, inChannel.size(), outChannel);      // original -- apparently has trouble copying large files on Windows

           // magic number for Windows, 64Mb - 32Kb)
           int maxCount = (64 * 1024 * 1024) - (32 * 1024);
           long size = inChannel.size();
           long position = 0;
           while ( position < size )
           {
              position += inChannel.transferTo( position, maxCount, outChannel );
           }
       }
       finally
       {
           if ( inChannel != null )
           {
              inChannel.close();
           }
           if ( outChannel != null )
           {
               outChannel.close();
           }
       }
   }

Looks fine to me, except it extends beyond the page.

It's supposed to properly colorcode it :slight_smile:

I think I was doing some testing of this one on a test forum installation and wasn't having any success…  I've been wanting to include something like this for some time since our wiki does such a nice job of it :stuck_out_tongue:

Well the mod-maker got back to me with what might be a fix. I’ve been trying to access the ftp all day but no go :confused:

followed the developer's advice, this is a test:

Code:
System.out.println("Hello Syntax");